:root{
  --bg: rgba(250,250,250,.78);
  --panel: rgba(255,255,255,.70);
  --panel-strong: rgba(255,255,255,.82);
  --text: #111827;
  --muted: rgba(17,24,39,.70);
  --border: rgba(17,24,39,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.06);
  --blur: 14px;

  --accent: #0284c7;
  --accent2: #16a34a;
  --accent3: #e11d48;

  --chip: rgba(0,0,0,.05);

  --btn-chill: #0284c7;
  --btn-bright: #111827;
  --btn-off: #e11d48;

  --ring: rgba(2,132,199,.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  --radius: 28px;
  --radius2: 22px;
}

html[data-theme="dark"]{
  --bg: rgba(9,9,11,.82);
  --panel: rgba(9,9,11,.45);
  --panel-strong: rgba(9,9,11,.58);
  --text: #f4f4f5;
  --muted: rgba(244,244,245,.70);
  --border: rgba(255,255,255,.12);
  --shadow: 0 10px 30px rgba(0,0,0,.28);
  --chip: rgba(255,255,255,.10);

  --btn-chill: #0ea5e9;
  --btn-bright: #f4f4f5;
  --btn-off: #fb7185;

  --ring: rgba(125,211,252,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(14,165,233,0.18), transparent 60%),
    radial-gradient(900px 500px at 80% 0%, rgba(34,197,94,0.14), transparent 60%),
    radial-gradient(900px 700px at 60% 100%, rgba(244,63,94,0.10), transparent 55%),
    var(--bg);
}

.wrap{
  min-height: 100%;
  padding: 16px;
  display: flex;
  justify-content: center;
}
.container{
  width: 100%;
  max-width: 1100px;
}

/* Header */
.header{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 14px;
}
.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 240px;
}
.logo{
  width: 52px;
  height: 52px;
  border-radius: 24px;
  background: var(--chip);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
}
.brand .meta{ min-width: 0; }
.brand .hello{ font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.brand .title{
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand .title-row{
  display:flex;
  align-items:center;
  gap:6px;
}

.header-actions{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pill{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  color: var(--text);
}

.date-time{ gap: 12px; }
.date-time .date{ font-size: 13px; color: var(--muted); white-space: nowrap; }
.date-time .sep{ width: 1px; height: 18px; background: var(--border); }
.date-time .time{ font-family: var(--mono); font-weight: 700; white-space: nowrap; }

.toggle{
  cursor: pointer;
  transition: transform .05s ease, background .2s ease;
  border: 1px solid var(--border);
}
.toggle:active{ transform: scale(.98); }
.toggle:focus-visible{ outline: none; box-shadow: 0 0 0 4px var(--ring); }
.toggle .icon{ width: 18px; height: 18px; display: inline-block; }
.toggle .label{ font-size: 13px; font-weight: 650; }

.mobile-datetime{ display: none; width: 100%; justify-content: space-between; }
@media (max-width: 640px){
  .date-time { display: none; }
  .mobile-datetime{ display: inline-flex; }
  .brand .title{ font-size: 18px; }
}

/* Grid / Cards */
.grid{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.card{
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  padding: 14px;
  overflow: hidden;
  min-height: 110px;
}
.card-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.card-title{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.badge{
  width: 38px; height: 38px;
  border-radius: var(--radius2);
  background: var(--chip);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.badge svg{ opacity: .85; }
.card-title h2{
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-right{ color: rgba(0,0,0,.0); } /* reserved */
html[data-theme="dark"] .card-right{ color: rgba(255,255,255,.0); }

.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.tiny{ font-size: 11px; }
.mono{ font-family: var(--mono); }

/* Spans */
.span-12{ grid-column: span 12; }
.span-7{ grid-column: span 7; }
.span-5{ grid-column: span 5; }
@media (max-width: 1024px){
  .span-7, .span-5{ grid-column: span 12; }
}

/* Widget host */
.widget-host{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
/* Each widget is already a .card; spans apply there */

/* Subgrid / Panels */
.subgrid{ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px){ .subgrid{ grid-template-columns: 1fr; } }

.panel{
  background: var(--chip);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 8px;
  gap: 10px;
}

.chips{ display:flex; flex-wrap: wrap; gap: 8px; }
.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
}
.chip svg{ opacity:.8; }

.tags{ display:flex; flex-wrap: wrap; gap: 8px; }
.tag{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,.05);
}

/* Calendar list */
.list{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-strong);
  overflow: hidden;
}
.item{
  display:flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.item:first-child{ border-top: 0; }
.item .time{
  width: 62px;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 12px;
}
.item .main{ min-width: 0; flex: 1; }
.item .main .t{
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .main .w{
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Buttons */
.btn-col{ display:flex; flex-direction: column; gap: 10px; }
.btn{
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 14px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(0,0,0,.12);
  transition: transform .05s ease, filter .2s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.btn:active{ transform: scale(.99); }
.btn:focus-visible{ outline:none; box-shadow: 0 0 0 4px var(--ring), 0 14px 28px rgba(0,0,0,.12); }
.btn .top{ display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.btn .left{ min-width:0; }
.btn .name{
  font-weight: 800;
  letter-spacing: -0.01em;
  display:flex;
  align-items:center;
  gap: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn .sub{ margin-top: 6px; opacity: .9; font-size: 13px; }
.btn .pwr{
  width: 42px; height: 42px;
  border-radius: 18px;
  background: rgba(255,255,255,.15);
  display:grid;
  place-items:center;
  flex: 0 0 auto;
}
.btn:hover{ filter: brightness(1.04); }

.btn.chill{ background: var(--btn-chill); }
.btn.bright{ background: var(--btn-bright); color: #fff; }
html[data-theme="dark"] .btn.bright{ background: var(--btn-bright); color: #111827; }
.btn.off{ background: var(--btn-off); }

footer{
  margin: 16px 0 6px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  background: rgba(17,24,39,.92);
  color: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  box-shadow: 0 18px 40px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  display:flex;
  align-items:center;
  gap: 10px;
  max-width: min(560px, calc(100% - 24px));
  backdrop-filter: blur(10px);
}
html[data-theme="dark"] .toast{ background: rgba(244,244,245,.92); color: #111827; }
.toast.show{ opacity: 1; transform: translateX(-50%) translateY(-4px); }
.toast .dot{ width: 8px; height: 8px; border-radius: 999px; background: var(--accent); flex: 0 0 auto; }

/* Kiosk helpers */
.kiosk-bar{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap: wrap;
}
.kiosk-pill{
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  cursor:pointer;
  user-select:none;
}
.kiosk-pill{
  color: var(--text);
}
html[data-theme="dark"] .kiosk-pill{
  color: #fff;
}
.kiosk-pill:focus-visible{ outline:none; box-shadow: 0 0 0 4px var(--ring); }

/* Footer / manual refresh */
.footer-info{
  margin: 16px 0 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.refresh-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:4px;
  padding:4px 6px;
  border-radius:999px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
  backdrop-filter: blur(6px);
  cursor:pointer;
  font-size: 11px;
  color: var(--text);
}
html[data-theme="dark"] .refresh-btn{
  color: var(--text);
}
.refresh-btn .refresh-icon{
  width:12px;
  height:12px;
  display:block;
}

