*, *::before, *::after { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
      font-size: 14px;
      line-height: 1.5;
      color: #1f2328;
      background: #f6f8fa;
    }

    /* ─── Status header ─────────────────────────────────────── */
    .status-header {
      padding: 48px 0 40px;
      text-align: center;
      color: #fff;
    }
    .status-header.operational { background: #1a7f37; }
    .status-header.degraded    { background: #9a6700; }

    .status-header h1 {
      font-size: 26px;
      font-weight: 600;
      margin: 0;
    }
    .status-header p {
      margin: 8px 0 0;
      font-size: 14px;
      opacity: 0.88;
    }

    /* ─── Page container ────────────────────────────────────── */
    .container {
      max-width: 800px;
      margin: 0 auto;
      padding: 0 24px;
    }

    /* ─── Section headings ──────────────────────────────────── */
    .section-heading {
      font-size: 12px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.06em;
      color: #57606a;
      margin: 0 0 10px;
    }

    /* ─── Maintenance dropdowns ──────────────────────────────── */
    .notices {
      margin: 24px 0;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .notice-dropdown {
      background: #fff;
      border: 1px solid #d0d7de;
      border-radius: 6px;
      overflow: hidden;
    }
    .notice-dropdown.active    { border-left: 4px solid #9a6700; }
    .notice-dropdown.scheduled { border-left: 4px solid #0969da; }
    .notice-dropdown.incident  { border-left: 4px solid #cf222e; }

    .notice-dropdown summary {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px 16px;
      font-weight: 600;
      color: #1f2328;
      cursor: pointer;
      list-style: none;
      user-select: none;
    }
    .notice-dropdown summary::-webkit-details-marker { display: none; }
    .notice-dropdown summary::before {
      content: '▶';
      font-size: 10px;
      color: #8c959f;
      transition: transform 0.15s;
      flex-shrink: 0;
    }
    .notice-dropdown[open] summary::before {
      transform: rotate(90deg);
    }

    .notice-cards {
      padding: 0 16px 12px;
    }
    .notice-card {
      background: #f6f8fa;
      border: 1px solid #d0d7de;
      border-radius: 6px;
      padding: 12px 14px;
      margin-top: 8px;
    }
    .notice-card .notice-title {
      display: flex;
      align-items: center;
      gap: 8px;
      font-weight: 600;
      margin: 0 0 4px;
      color: #1f2328;
    }
    .notice-card .notice-body {
      margin: 0;
      color: #57606a;
    }
    .notice-card .notice-meta {
      margin: 6px 0 0;
      font-size: 12px;
      color: #8c959f;
    }

    .notice-all-clear {
      background: #dafbe1;
      border: 1px solid #2da44e66;
      border-left: 4px solid #1f883d;
      border-radius: 6px;
      padding: 12px 16px;
    }

    .notice-all-clear-title {
      margin: 0;
      font-weight: 600;
      color: #1a7f37;
    }

    .notice-all-clear-body {
      margin: 2px 0 0;
      color: #1f2328;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      padding: 1px 8px;
      border-radius: 2em;
      font-size: 12px;
      font-weight: 500;
      line-height: 1.6;
    }
    .badge-active    { background: #fff8c5; color: #7d4e00; border: 1px solid #d4a72c55; }
    .badge-scheduled { background: #ddf4ff; color: #0550ae; border: 1px solid #54aeff55; }
    .badge-incident  { background: #ffebe9; color: #a40e26; border: 1px solid #ff818266; }

    /* ─── Components ────────────────────────────────────────── */
    .components {
      margin: 24px 0 48px;
    }
    .components-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 10px;
    }
    .components-header .legend {
      font-size: 12px;
      color: #57606a;
    }

    .component-card {
      background: #fff;
      border: 1px solid #d0d7de;
      border-radius: 6px;
      margin-bottom: 8px;
      overflow: hidden;
    }

    .monitor-grabbable-hint {
      position: relative;
      overflow: visible;
    }

    .monitor-grabbable-hint::before {
      content: '';
      position: absolute;
      left: -7px;
      top: 13px;
      width: 7px;
      height: 24px;
      border-radius: 4px 0 0 4px;
      border: 1px solid #d0d7de;
      border-right: none;
      background: repeating-linear-gradient(
        to bottom,
        #8c959f 0,
        #8c959f 2px,
        #f6f8fa 2px,
        #f6f8fa 5px
      );
      cursor: grab;
    }

    .monitor-grabbable-hint:active::before {
      cursor: grabbing;
    }

    .component-row {
      display: flex;
      align-items: center;
      padding: 12px 16px;
      gap: 10px;
    }

    .status-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .status-dot.operational { background: #1a7f37; }
    .status-dot.degraded    { background: #9a6700; }
    .status-dot.down        { background: #cf222e; }
    .status-dot.unknown     { background: #8c959f; }

    .component-name { font-weight: 600; flex: 1; }

    .maintenance-icon {
      font-size: 13px;
      margin-left: 4px;
      cursor: default;
    }

    .component-status-label {
      font-size: 12px;
      color: #57606a;
      text-transform: capitalize;
    }

    .component-uptime {
      font-size: 12px;
      color: #57606a;
      margin-left: 8px;
    }

    .component-meta {
      display: flex;
      gap: 16px;
      padding: 6px 16px 8px 36px;
    }

    .meta-item {
      font-size: 12px;
      color: #57606a;
    }

    .component-desc {
      font-size: 13px;
      color: #57606a;
      margin: 0;
      padding: 10px 16px 10px 36px;
    }

    .component-timeline {
      padding: 0 16px 12px 36px;
      display: flex;
      align-items: center;
      gap: 10px;
      transition: padding-left 220ms ease, gap 220ms ease;
    }

    .component-timeline[data-range='7d'] {
      padding-left: 16px;
      gap: 8px;
    }

    .timeline-bars {
      display: flex;
      gap: 2px;
      flex: 1;
      height: 28px;
      align-items: stretch;
      min-width: 0;
      opacity: 1;
      transform: scaleY(1);
      transition: opacity 220ms ease, transform 220ms ease, flex 260ms ease, gap 220ms ease, height 220ms ease;
      transform-origin: center;
    }

    .timeline-hidden {
      flex: 0 1 0 !important;
      opacity: 0;
      overflow: hidden;
      pointer-events: none;
      transform: scaleY(0.92);
      gap: 0;
    }

    .component-timeline[data-range='7d'] .timeline-bars-hourly {
      height: 32px;
      gap: 1px;
    }

    .component-timeline[data-range='7d'] .timeline-bars-hourly .timeline-bar {
      border-radius: 3px;
    }

    .timeline-bar {
      flex: 1;
      border-radius: 2px;
      background: #d0d7de;
      min-width: 0;
    }
    .timeline-bar.up       { background: #1a7f37; }
    .timeline-bar.degraded { background: #9a6700; }
    .timeline-bar.down     { background: #cf222e; }

    .timeline-label {
      font-size: 11px;
      color: #8c959f;
      white-space: nowrap;
      transition: color 220ms ease, opacity 220ms ease;
    }

    .component-timeline[data-range='7d'] .timeline-label {
      color: #57606a;
    }

    .timeline-zoom-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 3px;
      border: none;
      background: transparent;
      color: #8c959f;
      cursor: pointer;
      border-radius: 4px;
      line-height: 0;
      flex-shrink: 0;
    }
    .timeline-zoom-btn:hover {
      color: #0969da;
      background: #f3f4f6;
    }

    /* ─── Divider ───────────────────────────────────────────── */
    .divider {
      border: none;
      border-top: 1px solid #d0d7de;
      margin: 0;
    }

    /* ─── Admin header variant ──────────────────────────────── */
    .status-header.admin { background: #24292f; }

    /* ─── Toolbar (heading + action button) ─────────────────── */
    .toolbar {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      margin-bottom: 10px;
    }

    /* ─── Buttons ───────────────────────────────────────────── */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 12px;
      font-size: 12px;
      font-weight: 500;
      border-radius: 6px;
      border: 1px solid #d0d7de;
      cursor: pointer;
      background: #fff;
      color: #1f2328;
      text-decoration: none;
      line-height: 1.6;
    }
    .btn:hover { background: #f3f4f6; text-decoration: none; }
    .btn-primary { background: #1a7f37; border-color: rgba(31,35,40,.15); color: #fff; }
    .btn-primary:hover { background: #196c2e; color: #fff; }
    .btn-danger { color: #cf222e; }
    .btn-danger:hover { background: #fff1f0; border-color: #cf222e55; }
    .btn-sm { padding: 2px 8px; font-size: 11px; }

    /* ─── Form controls (used inside <dialog>) ──────────────── */
    .form-group { margin-bottom: 12px; }
    .form-group label {
      display: block;
      font-size: 12px;
      font-weight: 600;
      color: #1f2328;
      margin-bottom: 4px;
    }
    .form-group label .optional { font-weight: 400; color: #57606a; }
    .form-control {
      width: 100%;
      padding: 5px 10px;
      font-size: 13px;
      border: 1px solid #d0d7de;
      border-radius: 6px;
      background: #f6f8fa;
      color: #1f2328;
      outline: none;
      font-family: inherit;
    }
    .form-control:focus {
      border-color: #0969da;
      background: #fff;
      box-shadow: 0 0 0 3px rgba(9,105,218,.1);
    }
    textarea.form-control { resize: vertical; min-height: 64px; }
    .form-hint { font-size: 11px; color: #57606a; margin: 3px 0 0; }

    /* ─── Native <dialog> modal ─────────────────────────────── */
    dialog {
      border: 1px solid #d0d7de;
      border-radius: 12px;
      padding: 0;
      width: 100%;
      max-width: 460px;
      box-shadow: 0 8px 24px rgba(140,149,159,.2);
    }
    dialog::backdrop { background: rgba(0,0,0,.45); }
    .dialog-inner { padding: 20px 24px 24px; }
    .dialog-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;
    }
    .dialog-title {
      font-size: 15px;
      font-weight: 600;
      color: #1f2328;
      margin: 0;
    }
    .dialog-close {
      background: none;
      border: none;
      cursor: pointer;
      color: #57606a;
      font-size: 16px;
      line-height: 1;
      padding: 2px 4px;
      border-radius: 4px;
    }
    .dialog-close:hover { background: #f3f4f6; color: #1f2328; }
    .dialog-footer {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 16px;
      padding-top: 14px;
      border-top: 1px solid #d0d7de;
    }

    /* ─── Monitor checklist (inside create/edit maintenance) ─── */
    .monitor-checklist {
      display: flex;
      flex-direction: column;
      gap: 5px;
      max-height: 140px;
      overflow-y: auto;
      border: 1px solid #d0d7de;
      border-radius: 6px;
      padding: 8px 10px;
      background: #f6f8fa;
      font-size: 13px;
    }
    .monitor-checklist label {
      display: flex;
      align-items: center;
      gap: 7px;
      cursor: pointer;
      font-weight: 400;
      color: #1f2328;
    }
    .monitor-checklist label:hover { color: #0969da; }

    /* ─── Admin row actions ──────────────────────────────────── */
    .row-actions {
      display: flex;
      gap: 6px;
      margin-left: auto;
      flex-shrink: 0;
    }
    .row-meta {
      font-size: 12px;
      color: #57606a;
    }

    .container { max-width: 1100px; }
    .admin-grid {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 24px;
      margin: 24px 0 48px;
    }
    @media (max-width: 960px) { .admin-grid { grid-template-columns: 1fr 1fr; } }
    @media (max-width: 680px) { .admin-grid { grid-template-columns: 1fr; } }
    .badge-incident { background: #ffebe9; color: #cf222e; border: 1px solid #ff818266; }
    .admin-col { display: flex; flex-direction: column; gap: 8px; }
    .sub-heading {
      font-size: 11px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: #8c959f;
      margin: 12px 0 4px;
    }
    .sub-heading:first-of-type { margin-top: 4px; }
    .card-pad { padding: 14px 16px; }
    .maint-meta { padding: 6px 16px 10px; }

    /* ─── Login page ───────────────────────────────────────── */
    .login-page {
      font-family: sans-serif;
      max-width: 400px;
      margin: 100px auto;
      padding: 0 16px;
    }

    .login-page input {
      width: 100%;
      padding: 8px;
      margin: 8px 0;
      box-sizing: border-box;
    }

    .login-page button {
      padding: 8px 16px;
    }

    .login-page #error {
      color: red;
      min-height: 1.2em;
    }
    