:root {
  --platinum: #d7d7d7;
  --platinum-dark: #9b9b9b;
  --platinum-light: #f7f7f7;
  --ink: #111;
  --muted: #4b4b4b;
  --blue: #1f4fc4;
  --blue-dark: #0c2f85;
  --white: #fff;
  --shadow: rgba(0,0,0,.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --radius: 0px;
  --font: "Chicago", "Geneva", "Lucida Grande", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #6c6c6c;
}

body {
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}

button, input, textarea, select {
  font: inherit;
  color: var(--ink);
}

.classic-bg {
  min-height: 100vh;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(88px + var(--safe-bottom));
  background:
    linear-gradient(45deg, rgba(255,255,255,.08) 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,.10) 75%) 0 0 / 8px 8px,
    #777;
}

.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: calc(24px + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--platinum-light);
  border-bottom: 1px solid #222;
  box-shadow: 0 1px 0 #fff inset;
  font-size: 13px;
}

.menu-left, .menu-right {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
  white-space: nowrap;
}

.apple-mark {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: #111;
  font-size: 12px;
}

.strong { font-weight: 700; }

.window {
  width: min(980px, calc(100vw - 18px));
  margin: 12px auto 0;
  background: var(--platinum);
  border: 2px solid #111;
  box-shadow: 4px 4px 0 var(--shadow);
}

.titlebar {
  min-height: 25px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 2px solid #111;
  background: var(--platinum);
  position: relative;
}

.titlebar.mini {
  grid-template-columns: 1fr;
}

.title-stripes {
  grid-column: 1 / -1;
  grid-row: 1;
  height: 18px;
  margin: 3px 8px;
  background: repeating-linear-gradient(
    to bottom,
    #777 0,
    #777 1px,
    transparent 1px,
    transparent 3px
  );
}

.window-title {
  grid-column: 2;
  grid-row: 1;
  background: var(--platinum);
  padding: 2px 12px;
  font-weight: 700;
  text-align: center;
  z-index: 2;
}

.window-controls {
  grid-column: 1;
  grid-row: 1;
  z-index: 3;
  display: flex;
  gap: 7px;
  padding-left: 8px;
}

.window-controls span {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: var(--platinum-light);
  border: 1px solid #111;
  box-shadow: 1px 1px 0 #fff inset, -1px -1px 0 #777 inset;
}

.masthead {
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid #888;
  background: var(--platinum);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -1px;
}

h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.tagline, .version-line, .about-list, .muted {
  color: var(--muted);
}

.version-line {
  margin-bottom: 0;
  font-size: 13px;
}

.update-panel {
  min-width: 190px;
  padding: 9px;
  background: var(--platinum-light);
  border: 1px solid #111;
  box-shadow: 1px 1px 0 #fff inset, -1px -1px 0 #777 inset;
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid #111;
  background: #c4c4c4;
  margin-right: 6px;
  vertical-align: middle;
}

.status-dot.ok { background: #65c26f; }
.status-dot.warn { background: #ffd760; }
.status-dot.bad { background: #ff6b6b; }

.active-banner {
  display: none;
  margin: 12px 14px 0;
  padding: 10px;
  background: #fffbd2;
  border: 2px solid #111;
  box-shadow: 2px 2px 0 #777;
}

.active-banner.show { display: block; }

.nav-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid #888;
}

button, .file-btn, .classic-link-button {
  min-height: 38px;
  padding: 8px 10px;
  border: 2px solid #111;
  border-radius: var(--radius);
  background: var(--platinum-light);
  box-shadow: 2px 2px 0 #777, 1px 1px 0 #fff inset, -1px -1px 0 #9b9b9b inset;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  user-select: none;
}

button:active, .file-btn:active, .classic-link-button:active {
  box-shadow: 1px 1px 0 #777, -1px -1px 0 #fff inset, 1px 1px 0 #777 inset;
  transform: translate(1px, 1px);
}

button.primary, .nav-btn.active, .classic-link-button.primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 2px 2px 0 #777, 1px 1px 0 rgba(255,255,255,.45) inset, -1px -1px 0 var(--blue-dark) inset;
}

button.danger { background: #ffb2b2; }
button.small { min-height: 30px; padding: 5px 8px; font-size: 12px; }

.nav-btn {
  min-height: 42px;
  font-size: 13px;
  padding: 6px;
}

.page {
  display: none;
  padding: 14px;
}

.page.active { display: block; }

.toolbar-row, .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar-row { margin-bottom: 14px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.status-card, .panel, .record-card {
  background: var(--platinum-light);
  border: 2px solid #111;
  box-shadow: 2px 2px 0 #777, 1px 1px 0 #fff inset;
}

.status-card, .panel { padding: 12px; }

.status-card .big {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}

.panel { margin-bottom: 14px; }

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

label {
  display: grid;
  gap: 5px;
  font-weight: 700;
  font-size: 13px;
}

input, textarea, select {
  width: 100%;
  border: 2px solid #111;
  background: #fff;
  min-height: 38px;
  padding: 8px;
  border-radius: 0;
  box-shadow: 1px 1px 0 #777 inset;
  font-size: 16px;
}

textarea { resize: vertical; min-height: 90px; }

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-height: 22px;
  accent-color: #111;
}

.check-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  align-items: center;
  background: #eee;
  border: 1px solid #888;
  padding: 8px;
}

.span-all { grid-column: 1 / -1; }

.login-subform {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px;
  background: #ececec;
  border: 1px dashed #111;
}

.login-subform.show { display: grid; }

.warning-box {
  padding: 10px;
  background: #fffbd2;
  border: 1px solid #111;
  grid-column: 1 / -1;
  margin: 0;
}

.local-only-note {
  padding: 10px;
  margin: 0 0 14px;
  background: #eef5ff;
  border: 2px solid #111;
  box-shadow: 2px 2px 0 #777;
}

.compact-panel { padding-top: 10px; }

.simple-list {
  margin: 0;
  padding-left: 20px;
}

.simple-list li { margin: 5px 0; }

.stack {
  display: grid;
  gap: 10px;
}

.record-card {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.record-card header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  border-bottom: 1px solid #777;
  padding-bottom: 7px;
}

.record-card .meta {
  color: var(--muted);
  font-size: 12px;
}

.record-card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  border: 1px solid #111;
  padding: 3px 6px;
  background: #e8e8e8;
  font-size: 12px;
}

.badge.pending { background: #fffbd2; }
.badge.approved { background: #d8ffd8; }
.badge.denied { background: #ffd6d6; }
.badge.override { background: #d9e8ff; }
.badge.review { background: #eee0ff; }
.badge.emergency { background: #ffb2b2; }

.clock-display {
  padding: 12px;
  margin-bottom: 12px;
  background: #111;
  color: #66ff99;
  border: 2px inset #777;
  font-size: 22px;
  letter-spacing: 1px;
  min-height: 54px;
  display: flex;
  align-items: center;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.about-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 12px;
}

.about-list dt { font-weight: 700; color: #111; }
.about-list dd { margin: 0; }

.copyright { margin-bottom: 0; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.38);
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-window {
  width: min(420px, calc(100vw - 30px));
  background: var(--platinum);
  border: 2px solid #111;
  box-shadow: 4px 4px 0 rgba(0,0,0,.45);
}

.modal-body { padding: 14px; }

@media (max-width: 760px) {
  .hide-small { display: none; }

  .classic-bg {
    padding-bottom: calc(96px + var(--safe-bottom));
  }

  .window {
    width: calc(100vw - 10px);
    margin-top: 6px;
    box-shadow: 2px 2px 0 var(--shadow);
  }

  .masthead {
    grid-template-columns: 1fr;
  }

  h1 { font-size: 25px; }

  .update-panel { min-width: unset; }

  .nav-grid {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    padding: 8px 8px calc(8px + var(--safe-bottom));
    background: var(--platinum);
    border-top: 2px solid #111;
    border-bottom: 0;
    grid-template-columns: repeat(5, 1fr);
    box-shadow: 0 -2px 0 var(--shadow);
  }

  .nav-btn {
    min-height: 44px;
    font-size: 11px;
    padding: 4px 2px;
  }

  .dashboard-grid, .form-grid, .login-subform {
    grid-template-columns: 1fr;
  }

  .span-all { grid-column: 1; }

  .page { padding: 10px; }

  .toolbar-row, .button-row {
    align-items: stretch;
  }

  .toolbar-row > *, .button-row > * {
    flex: 1 1 140px;
  }

  .record-card header {
    flex-direction: column;
  }

  .about-list { grid-template-columns: 1fr; }
}
