:root{
  --bg: #050505;
  --panel: #0b0b0b;
  --panel2:#0f0f0f;
  --line:#1b1b1b;

  --amber: #ff8a00;
  --amber2:#ffb000;
  --muted: rgba(255,138,0,.75);
  --dim: rgba(255,138,0,.55);

  --ok: #37d67a;
  --bad: #ff4d4d;

  --r: 18px;
  --shadow: 0 14px 34px rgba(0,0,0,.55);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:#0a0a0a;
  color:var(--amber);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.shell{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.device{
  width:min(980px, 96vw);
  height:min(640px, 92vh);
  background:var(--bg);
  border-radius: 26px;
  box-shadow: var(--shadow);
  border:1px solid #151515;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  position:relative;
}

/* kill any accidental overlays from older CSS */
.device::before,
.device::after,
.list::before,
.list::after{
  content:none !important;
  display:none !important;
}

/* --- top bar --- */
.topbar{
  display:grid;
  grid-template-columns: 1fr auto 1fr;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  background: linear-gradient(to bottom, rgba(255,255,255,.03), transparent);
}

.topLeft{
  display:flex;
  gap:10px;
  align-items:center;
}

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius: 999px;
  font-size:13px;
  letter-spacing:.6px;
  border:1px solid rgba(255,138,0,.35);
  color: var(--amber);
  background: rgba(255,138,0,.08);
}

.badge.ok{
  border-color: rgba(55,214,122,.55);
  color: var(--ok);
  background: rgba(55,214,122,.12);
}
.badge.bad{
  border-color: rgba(255,77,77,.55);
  color: var(--bad);
  background: rgba(255,77,77,.10);
}

.badgePause{
  border-color: rgba(255,176,0,.55);
  color: var(--amber2);
  background: rgba(255,176,0,.12);
}

.topCenter{
  display:flex;
  justify-content:center;
}

.dots{
  display:flex;
  gap:8px;
  align-items:center;
}
.dot{
  width:10px;
  height:10px;
  border-radius:50%;
  border:1px solid rgba(255,138,0,.55);
  opacity:.75;
}
.dotOn{
  background: var(--amber);
  opacity:1;
}

.topRight{
  display:flex;
  justify-content:flex-end;
}

.gear{
  font: inherit;
  font-size:18px;
  width:40px;
  height:40px;
  border-radius: 12px;
  border:1px solid rgba(255,138,0,.35);
  background: rgba(255,138,0,.08);
  color: var(--amber);
  cursor:pointer;
}
.gear:hover{ background: rgba(255,138,0,.13); }

/* --- headline --- */
.headline{
  display:grid;
  grid-template-columns: 1fr auto;
  gap:18px;
  padding:16px 18px 10px 18px;
  border-bottom:1px solid var(--line);
}

.stopName{
  font-size: 46px;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: .5px;
}

.timeBlock{
  display:grid;
  grid-auto-flow:column;
  gap:14px;
  align-items:start;
  justify-items:end;
}

.clock{
  font-size: 46px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 1px;
}

.metaRight{
  text-align:right;
  margin-top: 4px;
}

.date{
  font-size: 14px;
  color: var(--muted);
  letter-spacing:.6px;
}

.weather{
  margin-top:6px;
  display:flex;
  gap:10px;
  justify-content:flex-end;
  align-items:baseline;
  color: var(--muted);
}
.wxIcon{
  font-size: 18px;
  line-height: 1;
}
.wxTemp{
  font-size: 16px;
  line-height: 1;
}

/* --- list --- */
.list{
  flex:1;
  padding: 12px 18px 10px 18px;
  overflow:hidden;
  position:relative;
  z-index: 3;
}

/* rows grid */
.row{
  display:grid;
  grid-template-columns: 44px 72px 1fr 88px 110px 26px;
  gap: 14px;
  align-items:baseline;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,138,0,.12);
  font-size: 24px;
  line-height: 1.18;
  color: var(--amber);
}

.row:last-child{ border-bottom: none; }

.c1{ color: var(--dim); }
.c2{ font-weight: 800; }
.c3{
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.c4, .c5{ text-align:right; }
.c6{ text-align:right; font-weight: 900; }

.row.stale{ opacity:.55; }

/* --- footer status --- */
.status{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 12px 16px;
  border-top:1px solid var(--line);
  background: linear-gradient(to top, rgba(255,255,255,.03), transparent);
  position:relative;
  z-index: 4;
}

.leftStatus{
  font-size: 13px;
  color: var(--muted);
}
.rightStatus{
  font-size: 13px;
  color: var(--muted);
}

/* --- setup modal --- */
.setup::backdrop{
  background: rgba(0,0,0,.6);
}

.setup{
  border:none;
  padding:0;
  background: transparent;
}

.setupInner{
  width:min(860px, 92vw);
  max-height: 86vh;
  overflow:auto;
  background: #0b0b0b;
  border:1px solid #1a1a1a;
  border-radius: 22px;
  box-shadow: var(--shadow);
  color: var(--amber);
  padding: 16px;
}

.setupHeader{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap: 14px;
  padding: 6px 4px 14px 4px;
  border-bottom:1px solid rgba(255,138,0,.16);
  margin-bottom: 14px;
}

.setupTitle{
  font-size: 28px;
  font-weight: 900;
}
.setupSubtitle{
  margin-top:2px;
  font-size: 14px;
  color: var(--muted);
}
.setupAp{
  font-size: 13px;
  color: var(--muted);
  padding-top: 6px;
}

.card{
  background: #0e0e0e;
  border:1px solid rgba(255,138,0,.18);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}

.cardTitle{
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .8px;
  margin-bottom: 10px;
  color: var(--amber2);
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label span{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select{
  width:100%;
  border-radius: 14px;
  border:1px solid rgba(255,138,0,.22);
  background: #0a0a0a;
  color: var(--amber);
  padding: 12px 12px;
  outline:none;
  font: inherit;
  font-size: 14px;
}

input:focus, select:focus{
  border-color: rgba(255,138,0,.55);
  box-shadow: 0 0 0 3px rgba(255,138,0,.12);
}

.rowActions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-top: 10px;
}

.btn{
  border:1px solid rgba(255,138,0,.30);
  background: rgba(255,138,0,.10);
  color: var(--amber);
  border-radius: 14px;
  padding: 10px 14px;
  cursor:pointer;
  font: inherit;
  font-size: 14px;
}
.btn:hover{ background: rgba(255,138,0,.16); }
.btn:disabled{ opacity:.45; cursor:not-allowed; }

.btn.primary{
  background: rgba(255,138,0,.18);
  border-color: rgba(255,138,0,.55);
  color: var(--amber2);
  font-weight: 800;
}
.btn.danger{
  border-color: rgba(255,77,77,.55);
  background: rgba(255,77,77,.12);
  color: var(--bad);
  font-weight: 800;
}

.hintSmall{
  font-size: 12px;
  color: var(--muted);
}

.addStop{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 10px;
}

.suggest{
  margin-top: 8px;
}

.stopList{ margin-top: 10px; }

.stop-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 10px 12px;
  border:1px solid rgba(255,138,0,.18);
  border-radius: 14px;
  background: rgba(255,255,255,.02);
  margin-bottom: 8px;
}

.stop-meta{
  margin-top:4px;
  font-size: 12px;
  color: var(--muted);
}

.stop-actions{
  display:flex;
  gap: 8px;
}

.icon-btn{
  width:38px;
  height:38px;
  border-radius: 12px;
  border:1px solid rgba(255,138,0,.22);
  background: rgba(255,138,0,.08);
  color: var(--amber);
  cursor:pointer;
  font: inherit;
}
.icon-btn:hover{ background: rgba(255,138,0,.14); }

/* dropdown for stop search */
.dropdown, #stopSearchDropdown{
  border:1px solid rgba(255,138,0,.22);
  border-radius: 14px;
  overflow:hidden;
  background:#070707;
  margin-top: 8px;
}

.dd-item{
  padding: 10px 12px;
  cursor:pointer;
  border-bottom:1px solid rgba(255,138,0,.10);
}
.dd-item:last-child{ border-bottom:none; }
.dd-item:hover{ background: rgba(255,138,0,.12); }

.hidden{ display:none !important; }

.setupButtons{
  display:flex;
  gap: 10px;
  justify-content:flex-end;
  margin-top: 12px;
  padding-top: 8px;
  border-top:1px solid rgba(255,138,0,.14);
}

.toast{
  position: sticky;
  bottom: 10px;
  margin-top: 12px;
  margin-left:auto;
  width: fit-content;
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid rgba(55,214,122,.40);
  background: rgba(55,214,122,.12);
  color: var(--ok);
  font-weight: 900;
}

/* --- confirm modal (basic) --- */
.confirm::backdrop{ background: rgba(0,0,0,.6); }
.confirm{
  border:none;
  padding:0;
  background: transparent;
}
.confirmInner{
  width:min(520px, 92vw);
  background:#0b0b0b;
  border:1px solid rgba(255,138,0,.18);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.confirmTitle{
  font-weight: 900;
  font-size: 18px;
  margin-bottom: 8px;
}
.confirmText{
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 12px;
}
.confirmBtns{
  display:flex;
  justify-content:flex-end;
  gap: 10px;
}

/* --- responsive --- */
@media (max-width: 720px){
  .device{ height: auto; min-height: 90vh; }
  .headline{ grid-template-columns: 1fr; }
  .timeBlock{ justify-items:start; }
  .stopName, .clock{ font-size: 38px; }
  .row{ grid-template-columns: 34px 62px 1fr 76px 92px 22px; font-size: 20px; }
  .grid2{ grid-template-columns: 1fr; }
}

/* --- top badges smaller (p.4) --- */
.badge{
  font-size: 11px;
  padding: 5px 8px;
}
.topbar{ padding: 12px 14px; }

/* --- emulated hardware buttons (p.1) --- */
.hwBtns{
  display:flex;
  gap:8px;
  align-items:center;
  margin-right: 10px;
}
.hwBtn{
  width:34px;
  height:34px;
  border-radius: 12px;
  border:1px solid rgba(255,138,0,.25);
  background: rgba(255,138,0,.08);
  color: var(--amber);
  cursor:pointer;
  font: inherit;
  font-size: 16px;
  line-height: 1;
}
.hwBtn:hover{ background: rgba(255,138,0,.14); }
.hwBtnDanger{
  border-color: rgba(255,77,77,.55);
  background: rgba(255,77,77,.12);
  color: var(--bad);
}

/* sleep badge */
.badgeSleep{
  border-color: rgba(255,176,0,.55);
  color: var(--amber2);
  background: rgba(255,176,0,.10);
}

/* --- list: fill vertical space (p.5) --- */
.row{
  font-size: 28px;     /* чуть крупнее */
  padding: 14px 0;     /* больше высота строки */
}
.list{
  padding-top: 14px;
  padding-bottom: 14px;
}

/* optional: make headline slightly tighter to give list more height */
.headline{ padding-bottom: 8px; }

/* --- row animation back (p.6) --- */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); filter: blur(1px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}
.row{
  animation: rowIn .22s ease both;
}

/* --- settings spacing (p.8) --- */
.stopAddWrap{
  display:block;
  margin-bottom: 12px;
}
.labelSmall{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 6px 0;
}
.stopAddActions{
  display:flex;
  gap: 12px;
  align-items:center;
  margin-top: 10px;
}
.hintTiny{
  font-size: 11px;
  opacity: .75;
}

/* ensure topbar is clickable above everything */
.topbar{
  position: relative;
  z-index: 50;
}

.hwBtns, .hwBtn{
  pointer-events: auto;
}

/* no wrapping in table cells */
.row > div{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* stop name: no wrap */
.stopName{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* keep minutes column tighter + aligned */
.c5{ text-align:right; }
.c6{ text-align:center; }

/* Sleep overlay */
.sleepOverlay{
  position:absolute;
  inset:0;
  z-index:9999;
  pointer-events:auto;
  cursor:pointer;
  background:#000;
  display:flex;
  align-items:center;
  justify-content:center;
}

.sleepOverlay[hidden]{ display:none; }

.sleepOverlay .sleepInner{
  display:flex;
  align-items:baseline;
  gap:18px;
  transform: translateY(-6px);
}

.sleepOverlay .sleepClock{
  font-size:92px;
  line-height:1;
  letter-spacing:2px;
}

.sleepOverlay .sleepWx{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:6px;
  opacity:.95;
}

.sleepOverlay .sleepWx .wxRow{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:22px;
}

.sleepOverlay .sleepHint{
  position:absolute;
  bottom:18px;
  left:18px;
  font-size:12px;
  opacity:.55;
}
