/* Fiszki — admin panel. Own minimal stylesheet, no frameworks/CDN. Light/dark via prefers-color-scheme. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5d6576;
  --border: #d9dde5;
  --accent: #2557d6;
  --accent-text: #ffffff;
  --danger: #c22f2f;
  --danger-bg: #fdeeee;
  --ok: #1d7a3d;
  --ok-bg: #e8f6ed;
  --field: #ffffff;
  --radius: .5rem;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171d;
    --surface: #1d2129;
    --text: #e6e9ef;
    --muted: #9aa3b5;
    --border: #343a46;
    --accent: #7aa2ff;
    --accent-text: #0d1220;
    --danger: #ff7b7b;
    --danger-bg: #3a1f22;
    --ok: #6fd394;
    --ok-bg: #19301f;
    --field: #12151b;
  }
}

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

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

h1 { font-size: 1.6rem; margin: .5rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
.card h2 { margin-top: 0; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
main.wrap { padding-bottom: 3rem; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: .25rem 0 1rem; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.25rem; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
.brand .muted { font-weight: 400; }
.inline { display: flex; align-items: center; gap: .5rem; margin: 0; }
.user { font-size: .9rem; }

/* Breadcrumb */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem; padding: 0; margin: 0 0 .5rem; }
.breadcrumb li + li::before { content: "/"; margin-right: .25rem; color: var(--muted); }
.breadcrumb [aria-current] { font-weight: 600; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin: 1rem 0;
}
.card.narrow { max-width: 24rem; margin: 3rem auto; }
.card-danger { border-color: var(--danger); }

/* Alerts */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid; overflow-wrap: anywhere; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }
.stack label { display: flex; flex-direction: column; gap: .25rem; width: 100%; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; margin-top: 1rem; }
.inline-form label { display: flex; flex-direction: column; gap: .25rem; flex: 1 1 16rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; }

input[type="text"], input[type="password"], input[type="file"] {
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .6rem;
  width: 100%;
  max-width: 32rem;
}
input:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: .95rem;
  padding: .45rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn-small { font-size: .85rem; padding: .25rem .6rem; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.copied { border-color: var(--ok); color: var(--ok); }

/* Copy link row */
.copy-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.copy-row .link-field { flex: 1 1 14rem; min-width: 10rem; font-size: .85rem; padding: .3rem .5rem; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: var(--bg); }
td.num, th.num { text-align: right; white-space: nowrap; }
.folder-link { font-weight: 600; text-decoration: none; }
.file-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.file-name { display: block; font-size: .85rem; }

/* Delete folder (details) */
.danger-zone summary { cursor: pointer; color: var(--danger); white-space: nowrap; }
.danger-zone[open] { min-width: 16rem; }
.danger-zone form { margin-top: .5rem; }

@media (max-width: 40rem) {
  h1 { font-size: 1.35rem; }
  th, td { padding: .5rem; }
  .user { display: none; }
}
