:root {
  --ink: #1f2430;
  --muted: #6f7885;
  --royal: #1e40af;
  --navy: #16305e;
  --gold: #c9a227;
  --gold-ink: #8a6d14;
  --gold-soft: #f6eed4;
  --bg: #f6f7fa;
  --card: #ffffff;
  --line: #e6e9ee;
  --ok-bg: #e8f5ec; --ok-ink: #1e6b3a;
  --err-bg: #fdecec; --err-ink: #9c2323;
  --ro-bg: #fdf3d7; --ro-ink: #7a5d0e;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--ink);
}

/* ---- Top bar: light, seal-forward -------------------------------------- */
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; height: 66px; position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-seal { width: 42px; height: 42px; object-fit: contain; }
.brand-name { display: block; color: var(--royal); font-weight: 800; font-size: 17px; letter-spacing: .2px; }
.brand-kicker { display: block; font-size: 9.5px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; color: #98a1ad; margin-top: 1px; }
.usernav { display: flex; align-items: center; gap: 14px; }
.username { color: var(--muted); font-size: 14px; }

/* ---- Layout -------------------------------------------------------------- */
.wrap { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 34px 24px 60px; }
.page-head { margin: 0 0 24px; }
.page-title { font-size: 24px; margin: 0 0 4px; color: var(--navy); }
.page-sub { margin: 0; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---- Folder tiles ---------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; }
.tile {
  position: relative; display: block; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px 18px;
  text-decoration: none; color: var(--ink);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.tile:hover { box-shadow: 0 10px 26px rgba(22, 48, 94, .12); transform: translateY(-2px); border-color: #d8dde5; }
.tile-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 11px;
  background: var(--gold-soft); color: var(--gold-ink); margin-bottom: 12px;
}
.tile-name { display: block; font-weight: 650; font-size: 15px; word-break: break-word; line-height: 1.3; }
.badge {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; border-radius: 20px; padding: 3px 10px;
}
.badge-ro { background: var(--ro-bg); color: var(--ro-ink); margin-top: 10px; }

/* ---- Breadcrumbs -------------------------------------------------------------- */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; font-size: 15px; }
.crumbs a { color: var(--royal); text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumb-sep { color: #c2c8d0; }
.crumb-here { font-weight: 700; color: var(--navy); }
.crumbs .badge-ro { margin: 0 0 0 8px; }

/* ---- Flash messages -------------------------------------------------------------- */
.flash { border-radius: 10px; padding: 11px 15px; margin: 0 0 16px; font-size: 14px; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }

/* ---- Action bar -------------------------------------------------------------- */
.actions {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 18px;
}
.action-form { display: flex; align-items: center; gap: 10px; }
.action-form input[type="text"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14px; background: #fff;
}
.action-form input[type="text"]:focus { outline: 2px solid #c7d4f5; border-color: #aebfe8; }
.action-form input[type="file"] { font-size: 13px; max-width: 330px; }

/* ---- File table -------------------------------------------------------------- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.files { width: 100%; border-collapse: collapse; }
.files th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 11px 16px; border-bottom: 1px solid var(--line); background: #fafbfd;
}
.files td { padding: 11px 16px; border-bottom: 1px solid #eef1f5; font-size: 14px; }
.files tr:last-child td { border-bottom: 0; }
.files tbody tr:hover td { background: #f8fafc; }
.rowlink { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 550; }
.rowlink:hover { color: var(--royal); }
.row-icon { display: inline-flex; }
.row-icon-folder { color: var(--gold-ink); }
.row-icon-file { color: #8792a0; }
.col-num { width: 110px; white-space: nowrap; }
.col-date { width: 185px; white-space: nowrap; }
.col-act { width: 92px; text-align: right; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 15px; font-size: 14px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: #c9cfd8; background: #f7f9fb; }
.btn-primary { background: var(--royal); border-color: var(--royal); color: #fff; }
.btn-primary:hover { background: #17348f; border-color: #17348f; }
.btn-quiet { padding: 7px 13px; font-size: 13px; }
.btn-danger { background: #fff; border-color: #ecc8c8; color: var(--err-ink); }
.btn-danger:hover { background: var(--err-bg); border-color: #e0b0b0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ---- Empty state / footer -------------------------------------------------------------- */
.empty {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 48px 32px; text-align: center;
}
.foot { text-align: center; color: #9aa3ad; font-size: 12px; padding: 18px; }
