:root {
  --bg: #f4efe6;
  --ink: #1d1914;
  --muted: #6f675e;
  --line: #e3d9cb;
  --panel: #fffdf8;
  --sidebar: #1e2a24;
  --sidebar-ink: #e8f0ea;
  --sidebar-dim: #b7c4bb;
  --accent: #2f6f4e;
  --accent-ink: #f4fff8;
  --gold: #8a6a32;
  --danger: #8d3b32;
  --danger-bg: #f8ece8;
  --shadow: 0 18px 50px rgba(48, 36, 18, 0.08);
  --radius: 18px;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", "PT Sans", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at top left, rgba(196, 161, 90, 0.18), transparent 28%),
    var(--bg);
}

.card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
}
h1, h2, h3 { font-weight: 650; letter-spacing: -0.02em; margin: 0 0 8px; }
h1 { font-size: 1.7rem; }
.muted { color: var(--muted); }
.form { display: grid; gap: 12px; margin-top: 18px; }
label { display: grid; gap: 6px; font-size: 0.92rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(47, 111, 78, 0.25);
  border-color: var(--accent);
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.btn.secondary, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.danger { background: var(--danger); color: white; }
.btn:disabled { opacity: 0.55; cursor: default; }
.row-actions, .toolbar, .split, .cluster { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 12px;
  padding: 10px 12px;
}

.shell { min-height: 100vh; display: grid; grid-template-columns: 270px 1fr; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.sidebar a { text-decoration: none; }
.side-link, .room-link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--sidebar-ink);
}
.side-link.active, .room-link.active, .side-link:hover, .room-link:hover { background: rgba(255,255,255,0.08); }
.side-section { color: var(--sidebar-dim); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 8px 10px; }
.sidebar .userbox { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar .btn.secondary { color: var(--sidebar-ink); border-color: rgba(255,255,255,0.25); }
.main { padding: 28px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pad { padding: 18px; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.room-card { display: block; text-decoration: none; padding: 18px; }
.room-card h2 { font-size: 1.15rem; }
.crumbs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0 14px; }
.crumbs a, .crumbs span { text-decoration: none; }
.file-table { width: 100%; }
.file-row, .file-head {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px 90px;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}
.file-head { color: var(--muted); font-size: 0.82rem; border-bottom: 1px solid var(--line); }
.file-row { border-bottom: 1px solid var(--line); }
.file-row:hover { background: #faf6ef; }
.file-row a { text-decoration: none; }
.file-row.locked { color: var(--muted); }
.name-btn {
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.drop-target.dragover { outline: 2px dashed var(--accent); outline-offset: -8px; }
.banner { margin-bottom: 12px; }
.denied {
  padding: 48px 28px;
  text-align: center;
}
.denied h1 { font-size: 2rem; color: var(--danger); }
.hint { font-size: 0.92rem; color: var(--muted); margin-top: 0; }
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(28, 25, 21, 0.35);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal { width: min(560px, 100%); }
.folder-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; margin-top: 12px; }
.net-auth:not([hidden]) { display: grid; gap: 12px; }
.links { display: grid; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.link-row input { font-size: 0.88rem; }
.admin-grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.list-btn { width: 100%; text-align: left; background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; }
.list-btn.active { border-color: var(--accent); background: #f3f8f5; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.check { display: flex; gap: 8px; align-items: center; }
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 2; }
  .admin-grid { grid-template-columns: 1fr; }
  .file-row, .file-head { grid-template-columns: 1fr 90px; }
  .hide-sm { display: none; }
}
