
:root{
  --bg:#f1f3f7;
  --card:#ffffff;
  --primary:#2f67ff;
  --primary2:#3b8cff;
  --text:#0f172a;
  --muted:#64748b;
  --green:#22c55e;
  --red:#ef4444;
  --shadow:0 10px 30px rgba(15,23,42,.12);
  --radius:22px;
}

html,body{
  height:100%;
  background:var(--bg);
}

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
}

body.modal-open{overflow:hidden;}

.app{
  min-height:100%;
  padding-bottom:96px; /* bottom nav */
}

.topbar{
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  padding: 16px 16px 38px 16px;
  box-shadow: var(--shadow);
}

.topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:#fff;
}

.brand-icon{
  width:44px;
  height:44px;
  border-radius:14px;
  background: #FEED41;
  display:flex;
  align-items:center;
  justify-content:center;
}

.brand-title{
  font-weight:800;
  font-size:18px;
  line-height:1.1;
}

.brand-sub{
  opacity:.9;
  font-size:12px;
  line-height:1.1;
  margin-top:2px;
}

.topbar-actions{
  display:flex;
  gap:10px;
}

.pill{
  border:0;
  background:#fff;
  border-radius:14px;
  padding:10px 12px;
  width:44px;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
}

.pill-lang{
  font-weight:800;
  letter-spacing:.4px;
}

.pill-gear svg{
  opacity:.85;
}

.content{
  margin-top: -24px;
  padding: 16px 16px;
  background:var(--bg);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
}

.section{
  /*margin-top:-10px;*/
  background: rgba(255,255,255,.55);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15,23,42,.08);
  backdrop-filter: blur(6px);
}

.section-title{
  font-size:12px;
  font-weight:800;
  letter-spacing:.8px;
  color: rgba(15,23,42,.55);
  margin-bottom:10px;
}

.queue-grid{
  display:grid;
  grid-template-columns: repeat(6, 1fr);
  gap:6px;
}

.queue-chip {
    border: 0;
    height: 34px;
    border-radius: 12px;
    font-weight: 800;
    background: #fff;
    color: #111827;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    font-size: 13px;
}

.queue-chip .mini-dot{
  position:absolute;
  top:6px;
  right:6px;
  width:6px;
  height:6px;
  border-radius:50%;
  background:#cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.queue-chip.on .mini-dot{ background: var(--green); }
.queue-chip.off .mini-dot{ background: var(--red); }

.queue-chip.active{
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color:#fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(47,103,255,.35);
}

.legend{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:16px;
  font-size:12px;
  color: var(--muted);
  justify-content: center;
}

.legend .sep{ opacity:.6; margin:0 4px; }

.dot{
  width:6px;
  height:6px;
  border-radius:50%;
  display:inline-block;
}

.dot-green{ background: var(--green); }
.dot-red{ background: var(--red); }

.status-card{
  margin-top:16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:10px;
}

.status-icon{
  width:74px;
  height:74px;
  border-radius:999px;
  background: rgba(34,197,94,.15);
  display:flex;
  align-items:center;
  justify-content:center;
}

.status-icon.off{
  background: rgba(239,68,68,.15);
}

.status-icon svg{
  width:34px;
  height:34px;
}

.status-title{
  font-weight:900;
  font-size:18px;
}

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

.status-timer{
  font-variant-numeric: tabular-nums;
  font-weight:900;
  letter-spacing:1.2px;
  font-size:22px;
  padding: 8px 12px;
  border-radius: 16px;
  background: #f3f5ff;
  color: #1e3a8a;
  min-width: 140px;
}

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

.tab-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tab-title{
  font-weight:800;
  display:flex;
  align-items:center;
  gap:8px;
}

.star{
  color:#f59e0b;
  font-size:18px;
  line-height:1;
}

.tab-date{
  font-size:12px;
  color: var(--muted);
  font-weight:700;
}

.segmentBlock {
    margin-top: 16px;
    background: rgba(255, 255, 255, .4);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
    padding: 16px 16px 16px 16px;
}

.segments{
  margin-top:12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.segment{
  border-radius: 12px;
  padding: 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .08);
  background: rgba(255, 255, 255, .65);
}

.segment.off{
  /*background: rgba(239,68,68,.10);*/
  border-left: 2px solid rgba(239, 68, 68, 1);
}

.segment.on{
  /*background: rgba(34,197,94,.10);*/
  border-left: 2px solid rgba(34,197,94, 1);
}

.segment-left{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:900;
  letter-spacing:.4px;
}

.segment-ic{
  width:18px;
  height:18px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.segment-ic svg{
  width:18px;
  height:18px;
}

.segment-time{
  font-variant-numeric: tabular-nums;
  font-size:16px;
}

.segment-right{
  font-size:12px;
  font-weight:800;
  color: rgba(15,23,42,.55);
}

/* Progress bar inside a segment (shows how far we are through the current interval) */
.segment-progress{
  position:absolute;
  left:0px;
  right:0px;
  height:100%;
  border-radius: 12px;
  overflow:hidden;
}

.segment-fill{
  height:100%;
  width:0%;
  border-radius: 12px;
  transition: width .6s linear;
}

.segment.on .segment-fill{
  background: rgba(34,197,94,.3);
}

.segment.off .segment-fill{
  background: rgba(239,68,68,.3);
}

.show-all-wrap{
  margin-top:12px;
}

.btn-showall{
  width:100%;
  border-radius: 18px;
  padding: 12px 16px;
  font-weight:900;
  box-shadow: 0 12px 26px rgba(47,103,255,.28);
}

.bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .8);
    backdrop-filter: blur(12px);
    display: flex;
    gap: 8px;
    justify-content: space-between;
    border-radius: 24px;
}

.nav-item{
  flex:1;
  border:0;
  background:transparent;
  border-radius: 18px;
  padding: 6px 6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:0px;
  color: rgba(15,23,42,.55);
}

.nav-item.active{
  background: rgba(47,103,255,.10);
  color: var(--primary);
}

.nav-label{
  font-size:11px;
  font-weight:800;
}

.nav-sub{
  font-size:10px;
  color: rgba(15,23,42,.45);
  font-weight:700;
  min-height: 12px;
}

.sheet-backdrop{
  position:fixed;
  inset:0;
  background: rgba(15,23,42,.35);
  backdrop-filter: blur(8px);
  z-index: 1000;
}

.sheet{
  position: fixed;
    top: 0px;
    left: 0px;
    right: 0px;
    bottom: 0px;
    z-index: 1001;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    /* border-radius: 24px; */
    box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sheet-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 16px 10px;
  border-bottom:1px solid rgba(15,23,42,.08);
}

.sheet-title{
  font-weight:900;
  font-size:16px;
}

.sheet-close{
  border:0;
  background:#fff;
  width:34px;
  height:34px;
  border-radius: 14px;
  font-size:22px;
  line-height:1;
  box-shadow: 0 6px 16px rgba(15,23,42,.12);
}

.sheet-body{
  padding: 14px 14px 18px;
  overflow:auto;
}

.queue-card{
  background:#fff;
  border-radius: 22px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(15,23,42,.10);
  margin-bottom: 12px;
  border: 2px solid transparent;
}

.queue-card.active{
  border-color: rgba(47,103,255,.55);
}

.queue-card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}

.queue-card-title{
  font-weight:900;
}

.queue-card-badge{
  font-size:10px;
  font-weight:900;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47,103,255,.10);
  color: var(--primary);
}

.history-list,.calc-list{
  margin-top: 12px;
}

.history-item{
  background:#fff;
  border-radius: 18px;
  padding: 12px 12px;
  box-shadow: 0 10px 24px rgba(15,23,42,.10);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 10px;
}

.history-date{
  font-weight:900;
}

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

.eye-btn{
  width:42px;
  height:42px;
  border-radius: 16px;
  border:0;
  background: rgba(15,23,42,.06);
  display:flex;
  align-items:center;
  justify-content:center;
}

.calc-row{
  background:#fff;
  border-radius: 18px;
  padding: 12px 12px;
  box-shadow: 0 10px 24px rgba(15,23,42,.10);
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}

.calc-left .q{
  font-weight:900;
}

.calc-left .sub{
  font-size:12px;
  color: var(--muted);
}

.calc-val{
  font-weight:900;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.empty-state{
  margin-top:12px;
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  text-align:center;
  box-shadow: var(--shadow);
  color: var(--muted);
}

.empty-state svg{
  width:48px;
  height:48px;
  margin-bottom:8px;
  opacity:.7;
}

.spacer{
  height: 24px;
}

/* ============================= */
/* Settings modal + iOS switches */
/* ============================= */

.modal-full{
  /*margin-top: 100px;*/
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(10,12,20,.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-full-inner{
  position: absolute;
  inset: 0;
  background: #f1f3f7;
  display: flex;
  flex-direction: column;
}

.modal-full-header{
  padding: 16px 16px;
  
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2f67ff;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}

.modal-title{font-weight: 900; letter-spacing: .2px;}

.modal-close{
  border: 0;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-full-body{
  padding: 12px 14px 18px;
  overflow: auto;
}

.settings-section{
  background: rgba(255, 255, 255, .8);
  border-radius: var(--radius);
  padding: 16px 16px 6px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 6px;
}

.settings-h{
  font-weight: 900;
  font-size: 13px;
  color: #1d2230;
  margin-bottom: 10px;
}

.settings-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(0,0,0,.06);
}

.settings-row:first-child{border-top:0; padding-top: 0;}

.settings-text{flex:1; min-width: 0;}
.settings-name{font-weight: 800; font-size: 13px; color:#1d2230;}
.settings-sub{font-size: 12px; color: var(--muted); margin-top: 2px;}

.time-input, .num-input{
  border: 0;
  background: rgba(0,0,0,.06);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
}
.time-input{width: 110px; text-align:center;}
.num-input{width: 90px; text-align:center;}

.ios-switch{position: relative; width: 52px; height: 32px; display:inline-block;}
.ios-switch input{opacity:0; width:0; height:0;}
.ios-slider{
  position:absolute; inset:0;
  background: rgba(0,0,0,.14);
  border-radius: 999px;
  transition: .2s ease;
}
.ios-slider:before{
  content:"";
  position:absolute;
  width: 28px; height: 28px;
  left: 2px; top: 2px;
  background:#fff;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
  transition: .2s ease;
}
.ios-switch input:checked + .ios-slider{background: #2f67ff;}
.ios-switch input:checked + .ios-slider:before{transform: translateX(20px);}

.segmented{
  display: inline-flex;
  background: rgba(0,0,0,.06);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}
.segmented .seg{
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 900;
  font-size: 12px;
  color: #1d2230;
}
.segmented .seg.active{
  background: #fff;
  box-shadow: 0 8px 16px rgba(0,0,0,.12);
}

.queue-select{display:flex; flex-wrap: wrap; gap: 8px; padding-top: 6px;}
.qsel{
  border: 0;
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 900;
  font-size: 12px;
}
.qsel.active{background:#2f67ff; color:#fff;}

.settings-actions{padding-top: 6px;}
