/* Immich AutoShare */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #64708a;
  --border: #dfe3ee;
  --primary: #4453d6;
  --primary-hover: #3543bb;
  --accent: #0ea5e9;
  --ok: #14803c;
  --ok-bg: #e2f5e9;
  --warn: #92600a;
  --warn-bg: #fdf0d8;
  --err: #b3261e;
  --err-bg: #fbe4e2;
  --shadow: 0 1px 3px rgba(20, 26, 60, .08), 0 4px 16px rgba(20, 26, 60, .05);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1421;
    --surface: #1a2133;
    --text: #e6e9f2;
    --muted: #98a2bd;
    --border: #2c3550;
    --primary: #6d7cff;
    --primary-hover: #8590ff;
    --accent: #38bdf8;
    --ok: #4ade80;
    --ok-bg: #143424;
    --warn: #fbbf24;
    --warn-bg: #3a2e12;
    --err: #f87171;
    --err-bg: #421d1b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1.4rem 0 .5rem; }
code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .85em;
  background: color-mix(in srgb, var(--border) 45%, transparent);
  border-radius: 5px;
  padding: .1em .35em;
  overflow-wrap: anywhere;
}

/* layout */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: .55rem 1rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a {
  color: var(--muted);
  padding: .3rem .7rem;
  border-radius: 8px;
  font-weight: 500;
}
.nav a:hover { color: var(--text); text-decoration: none; background: color-mix(in srgb, var(--border) 40%, transparent); }
.nav a.active { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); }
.nav-user { display: flex; align-items: center; gap: .6rem; }
.who { color: var(--muted); font-size: .9rem; }
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  flex: 1;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 1rem;
}

/* cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.1rem;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .25rem;
}
.card-head h2 { margin: 0; }
.card-attention { border-left: 4px solid var(--accent); }
.card-admin { border-left: 4px solid var(--primary); }
.card-danger { border-left: 4px solid var(--err); }
.callout { text-align: center; padding: 2rem 1.25rem; }
.callout h2 { font-size: 1.35rem; }

/* forms */
label { display: block; font-weight: 600; font-size: .88rem; margin: .8rem 0 .25rem; }
input[type=text], input[type=password], input[type=url], input[type=number], select {
  width: 100%;
  max-width: 480px;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > div { flex: 1 1 220px; }
.hint { color: var(--muted); font-size: .8rem; margin: .25rem 0 0; }
.radio, .check { display: flex; gap: .55rem; align-items: baseline; font-weight: 400; margin: .55rem 0; }
.radio input, .check input { flex-shrink: 0; }
button { font: inherit; }

/* buttons */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .45rem .95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: .6rem;
  transition: background .12s ease;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: .25rem .65rem; font-size: .85rem; margin-top: 0; }
.btn-block { width: 100%; max-width: 480px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: color-mix(in srgb, var(--primary) 11%, transparent);
  color: var(--primary);
}
.btn-secondary:hover { background: color-mix(in srgb, var(--primary) 20%, transparent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: color-mix(in srgb, var(--border) 40%, transparent); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger-outline { background: transparent; color: var(--err); border-color: var(--err); }
.btn-danger-outline:hover { background: var(--err-bg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* tables */
.table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.table th {
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: .4rem .55rem;
}
.table td { padding: .5rem .55rem; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:first-child td { border-top: none; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.inline-form { display: inline-block; }

/* badges + flash */
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .12rem .5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
  color: var(--muted);
  vertical-align: middle;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-err { background: var(--err-bg); color: var(--err); }
.badge-run { background: var(--warn-bg); color: var(--warn); animation: pulse 1.6s infinite; }
.badge-admin { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
@keyframes pulse { 50% { opacity: .55; } }

.flash {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  border-radius: 10px;
  padding: .65rem .9rem;
  margin-bottom: 1rem;
  font-size: .92rem;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-err { background: var(--err-bg); color: var(--err); }
.flash-close {
  background: none; border: none; color: inherit;
  font-size: 1.1rem; cursor: pointer; line-height: 1;
}

/* auth pages */
.auth-wrap { display: flex; justify-content: center; padding: 7vh 0; }
.auth-card { width: 100%; max-width: 400px; }
.auth-title { text-align: center; font-size: 1.3rem; margin: .25rem 0 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

/* people grid */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .9rem;
  margin-top: 1rem;
}
.person-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem .8rem .9rem;
  text-align: center;
  background: var(--bg);
}
.person-on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--bg)); }
.person-thumb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}
.person-name {
  font-weight: 600;
  margin-top: .4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-meta { font-size: .78rem; margin-bottom: .5rem; }

/* revokable person chips (owner dashboard) */
.chip-form { margin: .15rem .3rem .15rem 0; }
.chip {
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--border) 30%, transparent);
  color: var(--text);
  border-radius: 999px;
  padding: .18rem .65rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s ease;
}
.chip:hover { border-color: var(--err); color: var(--err); background: var(--err-bg); }

/* misc */
.help { margin-top: 1rem; }
.help summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.help div { margin-top: .5rem; }
.perm-list li { margin: .2rem 0; }
.invite { font-size: 1.05rem; padding: .25em .6em; }

@media (max-width: 640px) {
  .nav { order: 3; flex-basis: 100%; }
  .actions { justify-content: flex-start; }
  .table { display: block; overflow-x: auto; }
}
