*{
  box-sizing:border-box;
}

:root{
  --bg:#0b0d12;
  --panel:#12151d;
  --panel-2:#161a24;
  --line:#2a2f3a;
  --text:#eef2f7;
  --muted:#97a1b2;
  --green:#58d68d;
  --red:#ff6b6b;
  --purple:#8b7cf6;
  --blue:#77b7ff;
}

html,
body{
  height:100%;
  max-width:100%;
  overflow-x:hidden;
}

body{
  margin:0;
  max-width:100vw;
  overflow-x:hidden;
  font-family:Inter,system-ui,sans-serif;
  background:var(--bg);
  color:var(--text);
}

/* LOGIN SCREEN */

.hidden{
  display:none !important;
}

.login-gate{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
  background:
    linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.75)),
    url("./img/dvnnande.png");
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
}

.login-card{
  width:min(420px, 100%);
  padding:28px;
  border-radius:16px;
  background:rgba(10,13,18,.82);
  border:1px solid rgba(255,255,255,.15);
  text-align:center;
  backdrop-filter:blur(8px);
}

.login-card h1{
  margin-bottom:10px;
}

.login-card p{
  color:var(--muted);
  margin-bottom:18px;
}

.login-button{
  display:block;
  text-align:center;
  padding:12px;
  border-radius:8px;
  background:var(--blue);
  color:#08101a;
  font-weight:700;
  text-decoration:none;
}

/* APP LAYOUT */

.layout{
  min-height:100%;
  width:100%;
  max-width:100%;
  display:grid;
  grid-template-columns:320px 1fr;
  overflow-x:hidden;
}

.sidebar{
  border-right:1px solid var(--line);
  padding:20px;
  background:#10131a;
}

.main{
  padding:20px;
  min-width:0;
  max-width:100%;
  overflow-x:hidden;
}

h1,
h2,
h3{
  margin:0;
}

h1{
  font-size:1.55rem;
  margin-bottom:8px;
}

.muted{
  color:var(--muted);
}

.small{
  font-size:.85rem;
}

#loginStatus{
  margin-top:10px;
  margin-bottom:12px;
}

.site-title{
  display:flex;
  align-items:center;
  gap:12px;
}

.site-logo{
  width:42px;
  height:42px;
  object-fit:contain;
}

/* PANELS + FORMS */

.panel{
  margin-top:16px;
  padding:14px;
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:12px;
}

.panel-title{
  font-weight:700;
  margin-bottom:12px;
}

.sub-panel-title{
  margin-top:28px;
  margin-bottom:12px;
  padding-top:22px;
  border-top:1px solid var(--line);
  font-weight:700;
}

.form{
  display:grid;
  gap:10px;
}

label span{
  display:block;
  margin-bottom:6px;
  font-size:.9rem;
}

input,
select,
textarea,
button{
  width:100%;
  font:inherit;
}

input,
select,
textarea{
  background:#0d1016;
  color:var(--text);
  border:1px solid var(--line);
  border-radius:8px;
  padding:10px 12px;
}

button{
  border:none;
  border-radius:8px;
  padding:11px 12px;
  cursor:pointer;
  background:var(--blue);
  color:#08101a;
  font-weight:700;
}

button.secondary{
  background:#2a3140;
  color:var(--text);
}

button.danger{
  background:var(--red);
  color:#160507;
}

/* TOP BAR */

.topbar{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.badge{
  border:1px solid var(--line);
  padding:8px 10px;
  border-radius:999px;
  color:var(--muted);
  background:var(--panel);
  font-size:.9rem;
}

.legend{
  display:flex;
  gap:16px;
  flex-wrap:wrap;
  color:var(--muted);
  font-size:.92rem;
  margin-bottom:12px;
}

.swatch{
  width:14px;
  height:14px;
  display:inline-block;
  border-radius:3px;
  vertical-align:-2px;
  margin-right:6px;
}

.swatch-red{
  background:rgba(255,107,107,.55);
}

.swatch-green{
  background:rgba(88,214,141,.55);
}

.swatch-purple{
  background:rgba(139,124,246,.55);
}

/* TIMELINE */

.timeline-card{
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:12px;
  overflow:hidden;
}

.timeline-scroll{
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
}

.timeline{
  width:2200px;
}

.header-row,
.layer-row{
  display:grid;
  grid-template-columns:200px 2000px;
  width:2200px;
}

.header-row{
  position:sticky;
  top:0;
  z-index:5;
  background:var(--panel-2);
  border-bottom:1px solid var(--line);
}

.layer-row{
  height:140px;
  min-height:140px;
  border-bottom:1px solid var(--line);
}

.left-head,
.left-cell{
  position:sticky;
  left:0;
  z-index:20;
  padding:18px;
  border-right:1px solid var(--line);
  background:#12151d;
  overflow:hidden;
  box-shadow:10px 0 14px rgba(0,0,0,.35);
}

.left-head{
  z-index:30;
  background:#161a24;
}
.left-cell{
  height:140px;
  min-height:140px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:4px;
}

.left-cell .layer-name{
  font-weight:700;
}

.left-cell .layer-meta{
  font-size:.60rem;
  color:var(--muted);
  line-height:1.4;
}

.time-head{
  position:relative;
  height:58px;
  background:var(--panel-2);
}

.track{
  position:relative;
  z-index:1;
  height:140px;
  min-height:140px;
  background:#10131a;
  overflow:hidden;
}
.event-bar{
  z-index:2;
}

.day-marker{
  position:absolute;
  top:0;
  bottom:0;
  width:calc(100% / 7);
  border-right:1px solid rgba(255,255,255,.08);
}

.day-marker span{
  position:absolute;
  top:8px;
  left:10px;
  font-size:.9rem;
  color:var(--muted);
}

.day-marker strong{
  color:var(--text);
  font-size:.95rem;
}

.hour-label{
  position:absolute;
  bottom:2px;
  transform:translateX(-50%);
  font-size:.72rem;
  color:#778093;
}

.day-line{
  display:none;
}

.input-with-button{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:8px;
  width:100%;
}

.input-with-button input{
  min-width:0;
}
.sidebar{
  border-right:1px solid var(--line);
  padding:20px;
  background:#10131a;
  min-width:0;
  overflow:hidden;
}

.panel{
  margin-top:16px;
  padding:14px;
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:12px;
  min-width:0;
}
.input-with-button .small-button{
  width:auto;
  min-width:76px;
  padding:10px 14px;
}
.small-button{
  width:auto;
  padding:10px 12px;
  white-space:nowrap;
}
/* EVENT BARS */

.event-bar{
  position:absolute;
  border-radius:0;
  padding:0 8px;
  font-size:.99rem;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  border:1px solid rgba(255,255,255,.12);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  z-index:2;
}

.event-red{
  background:rgba(255,107,107,.22);
}

.event-green{
  background:rgba(88,214,141,.24);
}

.event-purple{
  background:rgba(139,124,246,.24);
}

.event-click{
  cursor:pointer;
}

.event-click:hover{
  outline:1px solid rgba(255,255,255,.35);
}



.event-start,
.event-end{
  flex-shrink:0;
  font-size:.83rem;
  font-weight:700;
  line-height:1.15;
  color:#ffffff;
  background:rgba(0,0,0,0);
  padding:6px 8px;
  border-radius:10px;
  text-align:center;
  white-space:normal;
}

.event-label{
  flex:1;
  text-align:center;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

/* NOW LINE */

.now-line{
  position:absolute;
  top:0;
  bottom:0;
  width:2px;
  background:#ffffff;
  z-index:3;
  pointer-events:none;
  box-shadow:0 0 8px rgba(255,255,255,.65);
}

.now-line-label{
  position:absolute;
  top:4px;
  transform:translateX(-50%);
  background:#ffffff;
  color:#0b0d12;
  font-size:.7rem;
  font-weight:700;
  padding:2px 6px;
  border-radius:999px;
  z-index:5;
  pointer-events:none;
}

/* ALERT DIALOG */

.alert-preview{
  margin-top:12px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:8px;
  background:#0d1016;
  color:var(--muted);
  white-space:pre-line;
  font-size:.9rem;
}

dialog{
  border:none;
  border-radius:12px;
  background:#10131a;
  color:var(--text);
  width:min(560px, calc(100vw - 24px));
}

dialog::backdrop{
  background:rgba(0,0,0,.55);
}

.dialog-content{
  padding:16px;
}

.dialog-content textarea{
  margin-top:10px;
}

.dialog-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:12px;
}

/* EMPTY STATE */

.empty{
  padding:30px;
  color:var(--muted);
}

/* MOBILE */

@media (max-width: 980px){
  .layout{
    grid-template-columns:1fr;
  }

  .sidebar{
    border-right:none;
    border-bottom:1px solid var(--line);
  }
}