:root {
  --teal: #1abc9c;
  --teal-hover: #16a085;
  --weather-reserved: 160px;
  --btn-h: clamp(120px, 18vh, 190px);
  --rail-bg: rgba(9, 14, 18, 0.82);
  --rail-border: rgba(255, 255, 255, 0.16);
  --panel-bg: rgba(12, 19, 26, 0.96);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --panel-soft-2: rgba(255, 255, 255, 0.08);
  --field-bg: rgba(7, 13, 18, 0.92);
  --field-border: rgba(255, 255, 255, 0.14);
  --field-text: rgba(255, 255, 255, 0.92);
  --field-muted: rgba(255, 255, 255, 0.52);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background: linear-gradient(to right, #2c3e50, #3498db);
  font-family: "Segoe UI", sans-serif;
  color: #fff;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.test-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 12px 16px;
  background: #8a1f2d;
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

body.has-test-banner main {
  padding-top: 188px;
}

body.has-test-banner #top-left-logo,
body.has-test-banner #clock {
  top: 68px;
}

#clock {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 1px 1px #000;
  font-family: monospace;
  z-index: 5;
}

#top-left-logo {
  position: absolute;
  top: 20px;
  left: 30px;
  height: 60px;
  width: auto;
  z-index: 5;
}

main {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding-top: 124px;
  padding-bottom: var(--weather-reserved);
}

.grid-wrap {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: var(--btn-h);
  gap: clamp(20px, 2.8vh, 34px) clamp(20px, 2vw, 34px);
  justify-items: stretch;
  align-content: center;
  width: 100%;
  max-width: min(1740px, calc(100vw - 48px));
  min-height: calc(100vh - 124px - var(--weather-reserved));
  padding: 8px 24px 0;
}

.button-tile {
  width: 100%;
  max-width: none;
  height: var(--btn-h);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  font-size: clamp(30px, 2.9vw, 42px);
  border: none;
  border-radius: 22px;
  background-color: var(--teal);
  color: white;
  box-shadow: 0 14px 28px rgba(0,0,0,0.28);
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease;
  line-height: 1.2;
  word-wrap: break-word;
  white-space: normal;
}

.button-tile:hover {
  background-color: var(--teal-hover);
  transform: translateY(-1px);
}

.tile-label {
  font-weight: 700;
  max-width: 14ch;
}

#weather-widget {
  position: fixed;
  bottom: -6px;
  height: 104px;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  text-align: center;
  line-height: 0;
  z-index: 4;
}

.weatherwidget-io {
  display: block;
  width: 100%;
  min-height: 140px;
  height: 140px;
}

#weather-widget iframe {
  display: block;
  width: 100%;
  height: 140px;
  margin: 0;
  vertical-align: bottom;
}

.rail-chip,
.rail-btn {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--rail-border);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.admin-login-btn {
  position: fixed;
  left: 12px;
  bottom: 14px;
  z-index: 12;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  background: rgba(6, 10, 14, 0.42);
  color: rgba(255,255,255,0.78);
  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.admin-login-btn:hover {
  background: rgba(6, 10, 14, 0.62);
  color: #fff;
}


.rail-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
}

.rail-chip[data-tone="error"] {
  background: rgba(122, 24, 24, 0.9);
}

.rail-chip[data-tone="success"] {
  background: rgba(13, 96, 78, 0.9);
}

.rail-btn {
  padding: 0 12px;
  cursor: pointer;
}

.rail-btn.off {
  background: rgba(0, 0, 0, 0.24);
  border-color: rgba(255, 255, 255, 0.22);
}

.rail-btn-primary {
  background: rgba(26, 188, 156, 0.92);
  border-color: rgba(255,255,255,0.12);
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(7, 12, 18, 0.44), rgba(8, 16, 24, 0.7)),
    url('./assets/login-bg.svg?v=20260627top') center 28% / cover no-repeat,
    #091018;
  backdrop-filter: blur(8px);
}

.login-shell {
  position: relative;
  width: min(480px, 100%);
  background: var(--panel-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.35);
  text-align: center;
}


.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  padding: 8px 10px;
  cursor: pointer;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 12px;
}

.login-brand-title {
  font-size: clamp(22px, 4vw, 26px);
  font-weight: 800;
  line-height: 1.1;
}

.login-brand-subtitle {
  margin-top: 4px;
  color: rgba(255,255,255,0.72);
  font-size: 14px;
}

.login-title {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-copy {
  margin: 0 0 20px;
  color: rgba(255,255,255,0.74);
  line-height: 1.5;
}

.primary-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #1d6ec8;
  cursor: pointer;
}

.primary-btn:hover {
  background: #165ba7;
}

.login-muted {
  margin-top: 14px;
  color: rgba(255,255,255,0.68);
  font-size: 13px;
}

.form-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #7e3743;
  background: #2a1418;
  color: #ffd6dc;
  font-size: 14px;
}

.screensaver-panel {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: rgba(0,0,0,0.94);
}

.admin-shell {
  width: min(760px, 100%);
  max-height: min(88vh, 920px);
  overflow: auto;
  text-align: left;
  scrollbar-color: rgba(117, 222, 199, 0.48) rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
}

.confirm-shell {
  width: min(420px, 100%);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-shell::-webkit-scrollbar,
.admin-list::-webkit-scrollbar {
  width: 10px;
}

.admin-shell::-webkit-scrollbar-track,
.admin-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
}

.admin-shell::-webkit-scrollbar-thumb,
.admin-list::-webkit-scrollbar-thumb {
  background: rgba(117, 222, 199, 0.42);
  border-radius: 999px;
  border: 2px solid rgba(11, 17, 23, 0.94);
}

.admin-shell::-webkit-scrollbar-thumb:hover,
.admin-list::-webkit-scrollbar-thumb:hover {
  background: rgba(117, 222, 199, 0.64);
}

.admin-modal-head {
  margin-bottom: 16px;
}

.screensaver-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.screensaver-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #96f1df;
}

.panel-title {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
}

.screensaver-stage {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  border-radius: 0;
  background: #000;
}

.screensaver-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.screensaver-image.is-active {
  opacity: 1;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 24px;
  color: rgba(255,255,255,0.78);
  text-align: center;
}

.screensaver-caption {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 13;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(5, 10, 14, 0.72);
  min-height: 20px;
  color: rgba(255,255,255,0.82);
  font-size: 13px;
}

.panel-copy {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.76);
}

.upload-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08);
}

.admin-section-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #96f1df;
}

.email-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: 220px;
  overflow: auto;
  padding: 4px;
}

.admin-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-soft-2);
  border: 1px solid rgba(255,255,255,0.08);
}

.admin-list-name {
  min-width: 0;
  font-size: 13px;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-list-name strong {
  display: block;
  margin-bottom: 4px;
  color: #fff;
  font-size: 14px;
}

.admin-list-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.66);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-log-entry {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--panel-soft-2);
}

.email-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.email-log-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #16304d;
  color: #8ec3ff;
  font: 800 10px Arial, Helvetica, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.email-log-pill[data-status="suppressed"] {
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.82);
}

.email-log-meta,
.email-log-reason {
  color: rgba(255,255,255,0.76);
  font-size: 12px;
  line-height: 1.5;
}

.email-log-actions {
  margin-top: 8px;
  text-align: right;
}

.email-log-toggle {
  border: 1px solid #30445d;
  background: #162434;
  color: #e8eef8;
  border-radius: 10px;
  padding: 6px 10px;
  font: 600 12px Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.email-log-details {
  display: none;
  margin-top: 10px;
}

.email-log-entry.is-open .email-log-details {
  display: block;
}

.email-log-details pre {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #0b1320;
  color: #d8e4f5;
  white-space: pre-wrap;
  word-break: break-word;
  font: 500 12px/1.5 Consolas, Monaco, monospace;
}

.button-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.button-admin-actions .rail-btn {
  flex: 1 1 180px;
}

.delete-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(133, 32, 42, 0.95);
  color: #fff;
  cursor: pointer;
}

.delete-btn:hover {
  background: rgba(157, 41, 53, 0.98);
}

.upload-label {
  font-size: 14px;
  font-weight: 700;
}

#buttonLabelInput,
#buttonUrlInput,
#screensaverFiles {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

#buttonLabelInput::placeholder,
#buttonUrlInput::placeholder {
  color: var(--field-muted);
}

#buttonLabelInput:focus,
#buttonUrlInput:focus,
#screensaverFiles:focus {
  outline: none;
  border-color: rgba(117, 222, 199, 0.72);
  box-shadow: 0 0 0 3px rgba(117, 222, 199, 0.14);
}

#screensaverFiles::file-selector-button {
  margin-right: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 9px;
  background: rgba(255,255,255,0.09);
  color: #fff;
  cursor: pointer;
}

#screensaverFiles::file-selector-button:hover {
  background: rgba(255,255,255,0.16);
}

@media (max-width: 640px) {
  #clock {
    top: 16px;
    right: 16px;
    font-size: 16px;
  }

  #top-left-logo {
    top: 16px;
    left: 16px;
    height: 42px;
  }

  main {
    padding-top: 98px;
  }

  .grid-wrap {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 0 16px;
    min-height: calc(100vh - 98px - var(--weather-reserved));
  }

  .button-tile {
    font-size: 24px;
    height: 110px;
  }

  .login-shell {
    padding: 22px;
  }
}

@media (min-width: 641px) and (max-width: 1100px) {
  .grid-wrap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: min(1180px, calc(100vw - 40px));
    min-height: calc(100vh - 124px - var(--weather-reserved));
  }
}


/* Microsoft sign-in button — matches Delivery Planner blue (added 2026-06-26: btn-ms markup existed but no rule in external styles.css) */
.btn-ms{display:inline-flex;align-items:center;gap:10px;justify-content:center;width:100%;padding:13px 18px;border:0;border-radius:10px;background:#1d6ec8;color:#fff;font-size:15px;font-weight:700;cursor:pointer}
.btn-ms:hover{background:#165ba7}
.btn-ms svg{width:18px;height:18px}
