/* jenianto.space – Home Server Dashboard styles */

  :root {
    --bg: #F6F6F3;
    --surface: #FFFFFF;
    --surface-2: #F0F0EC;
    --line: #E3E3DD;
    --text: #15171C;
    --muted: #6B6E76;
    --accent: #D98A00;
    --accent-soft: #FFF3DB;
    --ok: #16A34A;
    --ok-soft: #E6F6EC;
    --bad: #DC2626;
    --bad-soft: #FDECEC;
    --wait: #A1A1AA;
    --shadow: 0 1px 2px rgba(16, 18, 24, .04), 0 4px 16px rgba(16, 18, 24, .04);
    --radius: 16px;
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #0B0D12;
      --surface: #12151C;
      --surface-2: #181C25;
      --line: #232835;
      --text: #ECEDF0;
      --muted: #8A8F9C;
      --accent: #F5A524;
      --accent-soft: rgba(245, 165, 36, .12);
      --ok: #34D399;
      --ok-soft: rgba(52, 211, 153, .12);
      --bad: #F87171;
      --bad-soft: rgba(248, 113, 113, .12);
      --wait: #4B5162;
      --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --bg: #0B0D12; --surface: #12151C; --surface-2: #181C25; --line: #232835;
    --text: #ECEDF0; --muted: #8A8F9C; --accent: #F5A524; --accent-soft: rgba(245, 165, 36, .12);
    --ok: #34D399; --ok-soft: rgba(52, 211, 153, .12); --bad: #F87171; --bad-soft: rgba(248, 113, 113, .12);
    --wait: #4B5162; --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }

  * { box-sizing: border-box; margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex; flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
    -webkit-font-smoothing: antialiased;
  }
  .mono { font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
  button { font: inherit; color: inherit; }

  .wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

  /* ---------- Top bar ---------- */
  .topbar {
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(140%) blur(10px);
    -webkit-backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
  .brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
  .mark {
    width: 32px; height: 32px; border-radius: 9px; background: var(--accent);
    display: grid; place-items: center; flex-shrink: 0;
  }
  .brand-name { font-weight: 600; letter-spacing: -.01em; }
  .brand-sub { color: var(--muted); font-size: 13px; }
  .brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
  .top-right { display: flex; align-items: center; gap: .6rem; }
  .clock { color: var(--muted); font-size: 13px; padding-right: .4rem; }
  .icon-btn {
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; color: var(--muted);
    transition: color .15s, border-color .15s, background .15s;
  }
  .icon-btn:hover { color: var(--text); border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
  .icon-btn:focus-visible, .btn:focus-visible, .open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .spin svg { animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* ---------- Page header ---------- */
  .page-head { padding: clamp(2rem, 5vw, 3rem) 0 1.5rem; display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
  h1 { font-size: clamp(1.7rem, 3.5vw, 2.25rem); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
  .lead { color: var(--muted); margin-top: .35rem; }
  .pill {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: 13px; font-weight: 500;
    padding: .35rem .75rem; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--line);
  }
  .pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wait); }
  .pill[data-state="ok"] { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
  .pill[data-state="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); animation: breathe 2.4s ease-in-out infinite; }
  .pill[data-state="bad"] { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
  .pill[data-state="bad"] .dot { background: var(--bad); }
  .pill[data-state="wait"] .dot { animation: blink 1s ease-in-out infinite; }
  @keyframes breathe { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--ok) 0%, transparent); } }
  @keyframes blink { 50% { opacity: .3; } }

  .section-title {
    font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted); margin: 2.25rem 0 .9rem;
  }

  /* ---------- Cards ---------- */
  .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: rise .5s cubic-bezier(.2, .8, .2, 1) both;
  }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

  .overview { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
  .stat { padding: 1.25rem 1.35rem; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
  .stat-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: .45rem; }
  .stat-label svg { width: 15px; height: 15px; }
  .stat-value { font-size: 2rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
  .stat-value small { font-size: 1rem; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: .2rem; }
  .stat-note { color: var(--muted); font-size: 13px; }

  .health { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: center; }
  .ring { width: 92px; height: 92px; position: relative; }
  .ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
  .ring-track { stroke: var(--surface-2); }
  .ring-bar { stroke: var(--ok); transition: stroke-dashoffset .8s cubic-bezier(.2, .8, .2, 1), stroke .3s; }
  .ring-text { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 600; font-size: 1.15rem; }

  .services { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
  .svc { min-width: 0; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; transition: border-color .2s, transform .2s; }
  .svc:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); transform: translateY(-2px); }
  .svc-head { display: flex; align-items: center; gap: .85rem; }
  .svc-icon {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center;
    background: var(--tint-soft); color: var(--tint);
  }
  .svc-icon svg { width: 22px; height: 22px; }
  .svc-title { min-width: 0; flex: 1; }
  .svc-name { font-weight: 600; font-size: 1.05rem; letter-spacing: -.01em; }
  .svc-host { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .svc-desc { color: var(--muted); font-size: 14px; flex: 1; }

  .metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
  .metric { background: var(--surface-2); border-radius: 10px; padding: .6rem .8rem; }
  .metric-label { color: var(--muted); font-size: 12px; }
  .metric-value { font-weight: 500; font-size: 15px; }

  .history-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: .4rem; }
  .history { display: flex; gap: 3px; height: 26px; }
  .history span { flex: 1; border-radius: 3px; background: var(--surface-2); transition: background .3s; }
  .history span.up { background: var(--ok); }
  .history span.down { background: var(--bad); }

  .svc-foot { display: flex; gap: .5rem; margin-top: auto; }
  .open {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    height: 38px; border-radius: 10px; text-decoration: none; font-weight: 500; font-size: 14px;
    background: var(--text); color: var(--bg);
    transition: opacity .15s;
  }
  .open:hover { opacity: .88; }
  .open svg { width: 14px; height: 14px; }

  .btn {
    display: inline-flex; align-items: center; gap: .45rem;
    height: 34px; padding: 0 .85rem; border-radius: 9px; cursor: pointer;
    border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 500;
    margin-top: .5rem; align-self: flex-start;
  }
  .btn:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
  .btn svg { width: 14px; height: 14px; }

  .toast {
    position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500;
    padding: .55rem .95rem; border-radius: 10px; transition: opacity .2s, transform .2s; z-index: 20;
  }
  .toast.show { opacity: 1; transform: translate(-50%, 0); }

  footer.wrap { margin-top: auto; padding: 3rem 0 calc(1.75rem + env(safe-area-inset-bottom, 0px)); text-align: center; color: var(--muted); font-size: 13px; }

  @media (max-width: 860px) {
    .overview { grid-template-columns: 1fr 1fr; }
    .overview .health-card { grid-column: 1 / -1; }
  }
  @media (max-width: 520px) {
    .overview { grid-template-columns: 1fr; }
    .services { grid-template-columns: minmax(0, 1fr); }
    .clock { display: none; }
    .brand-sub { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
  }
