* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #111827;
  color: #f9fafb;
}

a {
  color: inherit;
}

/* Landing page */

.landing-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.landing-card {
  width: min(640px, 92vw);
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 18px;
  padding: 36px;
  text-align: center;
}

.landing-card h1 {
  margin-top: 0;
  font-size: 36px;
}

.landing-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 28px;
}

.landing-buttons a,
.studio-link,
.admin-actions button {
  display: inline-block;
  text-decoration: none;
  background: #2563eb;
  color: white;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
}

/* Studio page */

.studio-page {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #eeeeee;
  color: #07164a;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* 16:9 studio canvas */

.dashboard-shell {
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  margin: 0 auto;
  padding: 14px 18px 22px;
  display: grid;
  grid-template-rows: 128px minmax(0, 1fr);
  gap: 10px;
  background: #d6d6d6;
  overflow: hidden;
}

.top-bar {
  min-height: 0;
  display: grid;
  grid-template-columns: 235px 330px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.brand-block,
.clock-block,
.traffic-banner,
.panel {
  border-radius: 7px;
}

.brand-block {
  background: #003b8f;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.kyw-logo-img {
  width: 205px;
  max-height: 105px;
  object-fit: contain;
}

.clock-block {
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.current-time {
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  color: #07164a;
  text-align: center;
}

.current-date {
  margin-top: 8px;
  font-size: 25px;
  line-height: 1.12;
  font-weight: 400;
  color: #07164a;
  text-align: center;
}

.traffic-banner {
  position: relative;
  background: linear-gradient(90deg, #d8ecff, #b9d9f6);
  padding: 18px 24px;
  overflow: hidden;
}

.traffic-ribbon {
  margin-bottom: 10px;
}

.traffic-tease {
  font-size: 23px;
  line-height: 1.2;
  color: #111827;
  max-width: 94%;
}

.traffic-meta {
  position: absolute;
  left: 24px;
  bottom: 9px;
  font-size: 10px;
  color: #374151;
}

.freshness-warning {
  margin-left: 12px;
  font-size: 10px;
  font-weight: 800;
  color: #b45309;
}

.freshness-warning.is-stale {
  color: #b91c1c;
}

/* Main grid */

.dashboard-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 360px 405px minmax(0, 1fr);
  grid-template-rows: 186px 125px 205px minmax(145px, 1fr);
  grid-template-areas:
    "staff weather forecast"
    "stocks neighborhoods forecast"
    "stocks shore forecast"
    "stocks shore healthcast";
  gap: 10px;
}

.panel {
  border: 0;
  padding: 14px 16px;
  overflow: hidden;
  color: #07164a;
}

.panel h2 {
  margin: 0 0 8px;
  color: #004b9b;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 900;
}

/* Staff */

.staff-panel {
  grid-area: staff;
  background: transparent;
  padding: 0;
}

.staff-list {
  display: grid;
  gap: 6px;
  font-size: 22px;
}

.staff-row {
  height: 40px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  border-radius: 5px;
  overflow: hidden;
}

.staff-row span {
  padding-left: 8px;
  color: rgba(7, 22, 74, 0.35);
  font-size: 18px;
  font-weight: 900;
}

.staff-row strong {
  font-size: 20px;
  font-weight: 500;
  color: #374151;
  text-align: left;
  padding-left: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.traffic-staff {
  background: #cfe4f7;
}

.weather-staff {
  background: #bfe7dc;
}

.editor-staff {
  background: #f4c999;
}

.writer-staff {
  background: #c9cf82;
}

/* Ribbons */

.ribbon-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  line-height: 1;
  flex-wrap: wrap;
}

.ribbon-main {
  display: inline-block;
  background: #1587d1;
  color: white;
  padding: 4px 7px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ribbon-sponsor {
  display: inline-block;
  background: #d7edf8;
  border: 1px solid #6ab4e6;
  color: #07164a;
  padding: 4px 7px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 800;
}

/* Current weather */

.weather-panel {
  grid-area: weather;
  background: #24384b;
  color: white;
  padding: 0;
  position: relative;
}

.weather-panel h2 {
  display: none;
}

.weather-main {
  height: 100%;
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
}

.weather-details {
  display: grid;
  align-content: center;
}

.weather-icon {
  width: 105px;
  height: 105px;
  object-fit: contain;
}

.sky-condition {
  font-size: 28px;
  font-weight: 600;
  color: white;
  line-height: 1.05;
  margin-bottom: 4px;
}

.temperature {
  font-size: 66px;
  font-weight: 900;
  line-height: 0.95;
  color: white;
}

.weather-panel .mini-line {
  margin-top: 8px;
  color: white;
  font-size: 17px;
  font-weight: 800;
}

.weather-updated {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
  font-style: italic;
}

/* Forecast */

.forecast-panel {
  grid-area: forecast;
  background: linear-gradient(180deg, #cce9e8, #c9dceb);
  position: relative;
  padding-bottom: 26px;
}

.forecast-panel h2 {
  visibility: visible;
  height: auto;
  margin: 0 0 12px;
}

.body-text {
  white-space: pre-line;
  font-size: 23px;
  line-height: 1.34;
  color: #111827;
}

.forecast-updated {
  position: absolute;
  right: 16px;
  bottom: 9px;
  color: #4b5563;
  font-size: 9px;
  font-style: italic;
  text-align: right;
}

/* Neighborhood temperatures */

.neighborhoods-panel {
  grid-area: neighborhoods;
  background: #eeeeee;
  border-radius: 0;
  border-top: 1px solid #c8c8c8;
  border-bottom: 1px solid #c8c8c8;
  padding: 8px 14px 7px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
}

.neighborhoods-panel h2 {
  display: none !important;
}

.neighborhood-temps {
  width: 100%;
  color: #07164a;
  font-size: 23px;
  line-height: 1.08;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
}

.neighborhood-temps strong {
  display: inline !important;
  font-size: 25px;
  font-weight: 900;
}

.neighborhood-updated {
  margin-top: 5px;
  color: #4b5563;
  font-size: 8px;
  font-style: italic;
  text-align: right;
  white-space: nowrap;
}

/* Shore forecast */

.shore-panel {
  grid-area: shore;
  background: #b7d7ec;
}

.shore-panel h2 {
  display: inline-block;
  background: #1587d1;
  color: white;
  padding: 4px 7px;
  border-radius: 3px;
  font-size: 13px;
  margin-bottom: 7px;
}

.shore-panel .body-text {
  font-size: 18px;
  line-height: 1.25;
}

/* HealthCast */

.healthcast-alert {
  color: #b45309;
}

.healthcast-panel {
  grid-area: healthcast;
  background: #c8dbf0;
  position: relative;
}

.healthcast-panel h2 {
  color: #07164a;
  font-size: 15px;
  margin-bottom: 8px;
}

.healthcast-updated {
  margin-top: 6px;
  text-align: right;
  color: #4b5563;
  font-size: 9px;
  font-style: italic;
}

.healthcast-panel .ribbon-heading {
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

.healthcast-panel .ribbon-main,
.healthcast-panel .ribbon-sponsor {
  white-space: nowrap;
  font-size: 12px;
}

.healthcast-panel .body-text {
  font-size: 21px;
  line-height: 1.24;
}

/* Stocks */

.stocks-panel {
  grid-area: stocks;
  background: transparent;
  padding: 0;
  overflow: visible;
  position: relative;
}

.stocks-panel h2 {
  display: none;
}

.stock-row {
  height: 86px;
  display: grid;
  grid-template-columns: 0.9fr 1.25fr 0.9fr;
  grid-template-rows: 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 0 4px;
  border-bottom: 3px solid #d7d7d7;
  padding: 6px 8px;
  background: #ecf1ed;
  color: #2f3f39;
}

.stock-row.is-up {
  background: #c7e6c5;
}

.stock-row.is-down {
  background: #e7b6bd;
}

.stock-row.is-unchanged {
  background: #ecf1ed;
}

.stock-row > span {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: center;
  margin: 0;
  padding: 0;
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
}

.stock-row > strong {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: center;
  margin: 0;
  padding: 0;
  font-size: 21px;
  line-height: 1;
  font-weight: 400;
  text-align: center;
  color: #2f3f39;
}

.stock-row > em {
  display: contents;
  font-style: normal;
}

.stock-change-points {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  justify-self: center;
  display: block;
  margin: 0;
  padding: 0;
  font-size: 26px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
}

.stock-change-percent {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  justify-self: center;
  display: block;
  margin: 0;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  font-weight: 400;
  text-align: center;
}

.markets-updated {
  margin-top: 3px;
  text-align: right;
  color: #4b5563;
  font-size: 8px;
  font-style: italic;
}

.markets-mode-label {
  display: none;
}

.backup-dashboard-label {
  margin-top: 24px;
  text-align: center;
  color: #07164a;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.legal-id-label {
  margin-top: 6px;
  text-align: center;
  color: #07164a;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.02em;
  opacity: 0.78;
}

.markets-overlay {
  display: none;
  position: absolute;
  inset: 0 0 46px 0;
  z-index: 5;
  background: rgba(236, 241, 237, 0.92);
  color: #07164a;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
  font-size: 25px;
  line-height: 1.15;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 4px;
}

.markets-overlay.is-visible {
  display: flex;
}

/* Admin page */

.admin-page {
  background: #f3f4f6;
  color: #111827;
}

.admin-shell {
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: 32px 0 80px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-header h1 {
  margin: 0;
}

.admin-header p {
  margin: 6px 0 0;
  color: #4b5563;
}

.admin-form {
  display: grid;
  gap: 20px;
}

.admin-section {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  padding: 22px;
}

.admin-section h2 {
  margin: 0 0 16px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 16px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #9ca3af;
  border-radius: 10px;
  padding: 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.helper-text {
  color: #6b7280;
  margin-top: -6px;
}

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

.checkbox-label input {
  width: auto;
}

.manual-field-is-disabled {
  opacity: 0.48;
}

.manual-field-is-disabled input,
.manual-field-is-disabled textarea {
  background: #e5e7eb;
  cursor: not-allowed;
}

.admin-actions {
  position: sticky;
  bottom: 0;
  background: #f3f4f6;
  border-top: 1px solid #d1d5db;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
}

.admin-actions button:nth-child(2) {
  background: #4b5563;
}

.traffic-admin-bottom-link {
  margin-left: auto;
  background: #4b5563;
}

#saveStatus {
  color: #374151;
  font-weight: 700;
}
