/* Happy1z PhotoShare — shared dark design system */
:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface2: #1f232c;
  --line: #2a2f3a;
  --ink: #e8e6df;
  --ink2: #a8a49a;
  --muted: #6d6a63;
  --accent: #c9a86a;
  --accent-hi: #dfc08a;
  --accent-ink: #16130c;
  --good: #4caf7d;
  --warn: #d9a441;
  --bad: #e05d5d;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  line-height: 1.55; -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 650; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
p { margin: .4em 0; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1.25rem; }

.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.25rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px); z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .02em; color: var(--ink); font-size: 1.05rem; }
.brand .z { color: var(--accent); }
.nav .links { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: .55rem 1.15rem; border-radius: 8px; transition: background .15s;
}
.btn:hover { background: var(--accent-hi); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--bad); }
.btn.sm { padding: .35rem .8rem; font-size: .85rem; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface2);
  border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type="checkbox"] {
  appearance: auto; -webkit-appearance: auto;
  width: 1.15rem; height: 1.15rem; padding: 0; margin-right: .45rem;
  accent-color: var(--accent); background: none; border: none; vertical-align: -2px;
  cursor: pointer;
}

/* Custom toggle switch: <label class="switchrow"><input type="checkbox"><span class="switch"></span> text</label> */
.switchrow { display: flex; align-items: center; gap: .6rem; cursor: pointer; color: var(--ink); }
.switchrow input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch {
  flex: 0 0 auto; width: 2.6rem; height: 1.45rem; border-radius: 999px;
  background: var(--surface2); border: 1px solid var(--line);
  position: relative; transition: background .15s, border-color .15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--ink2); transition: left .15s, background .15s;
}
.switchrow input:checked + .switch { background: var(--accent); border-color: var(--accent); }
.switchrow input:checked + .switch::after { left: calc(100% - 1.1rem - 2px); background: var(--accent-ink); }
.switchrow input:focus-visible + .switch { outline: 2px solid var(--accent-hi); }
label { font-size: .85rem; color: var(--ink2); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem; margin: 1rem 0;
}
.grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .18rem .6rem; border-radius: 999px; margin-right: .35rem;
  border: 1px solid transparent;
}
.badge.ok { color: var(--good); border-color: var(--good); }
.badge.todo { color: var(--warn); border-color: var(--warn); }
.badge.off { color: var(--muted); border-color: var(--line); }

.muted { color: var(--muted); font-size: .85rem; }
.sub { color: var(--ink2); font-size: .9rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th {
  text-align: left; color: var(--ink2); font-weight: 600;
  padding: .45rem .6rem; border-bottom: 1px solid var(--line);
}
table.data td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: var(--surface2); }
.scroll-x { overflow-x: auto; }

.tabs { display: flex; gap: .25rem; margin: 1rem 0; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--ink2);
  background: transparent; border: 0; padding: .5rem .9rem; border-radius: 8px;
}
.tabs button.active { background: var(--surface2); color: var(--ink); }

.meter { background: var(--surface2); border-radius: 6px; height: 10px; overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); border-radius: 6px 0 0 6px; }
.meter.warn > div { background: var(--warn); }
.meter.bad > div { background: var(--bad); }

.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; }
.tile .n { font-size: 1.7rem; font-weight: 700; }
.tile .l { color: var(--ink2); font-size: .82rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--surface2); color: var(--ink); border: 1px solid var(--line);
  padding: .6rem 1.2rem; border-radius: 10px; opacity: 0; transition: opacity .3s;
  pointer-events: none; z-index: 100; max-width: 90vw;
}
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  max-width: 34rem; width: 100%; max-height: 85vh; overflow-y: auto; padding: 1.5rem;
}
.hidden { display: none !important; }
