:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1d2321;
  --muted: #6b7471;
  --line: #e1ddd5;
  --accent: #136f63;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ed;
  --warn: #9a5b00;
  --err: #b3261e;
  --ok: #1d7a3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141716;
    --card: #1d2120;
    --ink: #e9ecea;
    --muted: #9aa39f;
    --line: #2f3533;
    --accent: #3fb3a1;
    --accent-ink: #0d1312;
    --accent-soft: #1f3330;
    --warn: #e0a64a;
    --err: #ff8a80;
    --ok: #7bd49a;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
h1 { font-size: 1.6rem; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--err); min-height: 1.2em; margin: .4rem 0; }
.err:empty { min-height: 0; margin: 0; }
.hint { color: var(--warn); margin: .3rem 0 0; }
.hint:empty { display: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 650; display: flex; align-items: center; gap: 10px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block;
  background-image: linear-gradient(135deg, transparent 45%, rgba(255,255,255,.55) 45% 55%, transparent 55%); }
.who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { font-size: .8rem; padding: 3px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.on { color: var(--ok); border-color: currentColor; }
.chip::before { content: "●"; margin-right: 5px; }

.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.ghost:hover { border-color: var(--muted); }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 9px; padding: 9px 16px; font-weight: 600; }
.primary:disabled { opacity: .5; cursor: default; }
.x { background: none; border: 0; font-size: 1.5rem; line-height: 1; color: var(--muted); padding: 2px 8px; border-radius: 8px; }
.x:hover { color: var(--ink); background: var(--bg); }

.wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.intro { margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.narrow { max-width: 380px; width: 100%; }
.wide { max-width: 860px; width: 100%; max-height: 90vh; overflow: auto; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

.login { display: grid; place-items: center; min-height: calc(100vh - 60px); padding: 16px; }
.login .primary { width: 100%; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: .8rem; color: var(--muted); }
.field input, .field select {
  border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; width: 100%; min-width: 0;
}
.pw { display: flex; position: relative; }
.pw input { padding-right: 40px; }
.eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; border: 0; opacity: .6; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line); border-radius: 16px; padding: 34px 16px; background: var(--card); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.dropIcon { font-size: 1.6rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.bar { width: min(320px, 100%); height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

#list { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.upHead { display: flex; gap: 14px; align-items: flex-start; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--bg); flex: none; }
.meta { flex: 1; min-width: 0; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.opts { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 14px; }
@media (max-width: 720px) { .opts { grid-template-columns: 1fr 1fr; } .opts .field:first-child { grid-column: 1 / -1; } .opts .primary { grid-column: 1 / -1; } }

.results { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.res { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 11px; padding: 8px 10px; flex-wrap: wrap; }
.res img { width: 54px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--bg); flex: none; }
.res .info { flex: 1; min-width: 160px; }
.res .tag { font-weight: 600; }
.res .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.res .acts a, .res .acts button.btn { text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; background: var(--card); color: var(--ink); font-size: .9rem; }
.res .acts a.dl { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.res .note { color: var(--warn); }
.res .bar { margin-top: 6px; width: 100%; }
.res.err .tag { color: var(--err); }

.modal { position: fixed; inset: 0; background: rgba(10, 14, 13, .62); z-index: 20; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.lupeBox { background: var(--card); border-radius: 14px; width: min(1400px, 100%); height: min(920px, 100%); display: flex; flex-direction: column; overflow: hidden; }
.lupeTop { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lupeTitle { font-weight: 600; flex: 1; min-width: 160px; }
.inline { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); }
.inline select { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 5px 8px; color: var(--ink); max-width: 260px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 5px 10px; font-size: .9rem; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.lupeBody { flex: 1; display: grid; grid-template-columns: minmax(180px, 26%) 1fr; min-height: 0; }
.overview { position: relative; overflow: hidden; padding: 10px; border-right: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: center; user-select: none; touch-action: none; }
.overview img { max-width: 100%; max-height: 100%; display: block; cursor: crosshair; }
.mark { position: absolute; border: 2px solid #ffcc00; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .25); pointer-events: none; }
.panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.pane { margin: 0; display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }
.pane figcaption { font-size: .85rem; padding: 6px 10px; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view { flex: 1; overflow: hidden; position: relative; background: repeating-conic-gradient(var(--bg) 0 25%, var(--card) 0 50%) 0 0 / 16px 16px; cursor: grab; touch-action: none; }
.view.drag { cursor: grabbing; }
.view img { position: absolute; left: 0; top: 0; image-rendering: pixelated; transform-origin: 0 0; }
.panes.single { grid-template-columns: 1fr; }
.panes.single #paneB { display: none; }
.lupeHint { margin: 0; padding: 6px 12px; border-top: 1px solid var(--line); }
@media (max-width: 820px) {
  .lupeBody { grid-template-columns: 1fr; grid-template-rows: 30% 1fr; }
  .overview { border-right: 0; border-bottom: 1px solid var(--line); }
  .panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .pane { border-right: 0; border-bottom: 1px solid var(--line); }
}

.newAccess { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr auto; gap: 10px; align-items: end; margin: 14px 0 4px; }
@media (max-width: 720px) { .newAccess { grid-template-columns: 1fr; } }
.tableWrap { overflow-x: auto; }
.acc { width: 100%; border-collapse: collapse; font-size: .9rem; }
.acc th, .acc td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.acc th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.acc td input[type=date] { border: 1px solid var(--line); background: var(--bg); border-radius: 7px; padding: 4px 6px; }
.acc .expired { color: var(--err); }
.acc code { background: var(--bg); padding: 2px 6px; border-radius: 6px; }
.linkBtn { background: none; border: 0; color: var(--accent); padding: 2px 4px; font-size: .85rem; }
