:root {
  --bp-navy: #1f3a5f;
  --bp-navy-dark: #16283f;
  --bp-accent: #2e7d6b;
  --bp-accent-dark: #245c50;
  --ink: #1c2430;
  --muted: #6b7583;
  --line: #e2e6ec;
  --bg: #f5f7fa;
  --card: #ffffff;
  --danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,32,54,.08), 0 4px 16px rgba(16,32,54,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--bp-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top bar ---- */
.topbar {
  background: var(--bp-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 60px;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 17px; letter-spacing: .2px; }
.topbar .brand img { height: 34px; width: auto; display: block; }
.topbar .user { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.topbar .user .name { opacity: .85; }
.topbar .user a { color: #fff; opacity: .9; }

/* ---- Layout ---- */
.wrap { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .card-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.card .card-body { padding: 20px; }

/* ---- Breadcrumb / folder chips ---- */
.folder-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.folder-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); color: var(--ink); font-size: 14px; cursor: pointer;
}
.folder-tab.active { background: var(--bp-navy); color: #fff; border-color: var(--bp-navy); }
.folder-tab .ic { opacity: .7; }

.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { margin: 0 6px; opacity: .5; }
.crumbs .here { color: var(--ink); font-weight: 600; }

/* ---- File table ---- */
table.files { width: 100%; border-collapse: collapse; }
table.files th, table.files td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); }
table.files th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
table.files tr:last-child td { border-bottom: none; }
table.files td.name { font-weight: 500; }
table.files td.size, table.files td.date { color: var(--muted); white-space: nowrap; }
table.files td.actions { text-align: right; white-space: nowrap; }
.row-icon { display: inline-block; width: 20px; text-align: center; margin-right: 10px; opacity: .8; }
.file-link { background: none; border: none; padding: 0; font: inherit; color: var(--ink); cursor: pointer; }
.file-link:hover { color: var(--bp-accent); }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; background: #eef1f5; color: var(--ink);
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--bp-accent); color: #fff; }
.btn-primary:hover { background: var(--bp-accent-dark); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-danger { background: #fff; border-color: #e6c3bf; color: var(--danger); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---- Login ---- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand { text-align: center; margin-bottom: 22px; }
.login-card .brand img { height: 54px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input[type=text], .field input[type=password], .field input[type=email],
.field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--bp-accent); box-shadow: 0 0 0 3px rgba(46,125,107,.15);
}
.alert { padding: 11px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
.alert-ok { background: #e8f5e9; color: #256a34; border: 1px solid #b7dfbd; }
.muted-note { color: var(--muted); font-size: 13px; }

/* ---- Admin ---- */
.admin-nav { display: flex; gap: 4px; background: var(--bp-navy-dark); padding: 0 20px; }
.admin-nav a { color: #cfd8e3; padding: 14px 16px; font-size: 14px; font-weight: 500; border-bottom: 3px solid transparent; }
.admin-nav a:hover { color: #fff; text-decoration: none; }
.admin-nav a.active { color: #fff; border-bottom-color: var(--bp-accent); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-role { background: #eef1f5; color: var(--muted); }
.badge-on { background: #e8f5e9; color: #256a34; }
.badge-off { background: #fdecea; color: var(--danger); }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
table.grid th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  table.files td.size { display: none; }
  .wrap { margin: 14px auto; }
}
