:root {
  --bg: #12151a;
  --panel: #181c22;
  --panel-hover: #1d222a;
  --border: #2a2f38;
  --border-card: #4a5262;
  --text: #e8e8ea;
  --text-dim: #a7adb8;
  --text-faint: #8b8f99;
  --blue: #5aa9ff;
  --green: #4fd18b;
  --green-primary: #1e9765;
  --green-primary-hover: #27b378;
  --red: #ff6b6b;
  --purple: #c792ea;
  --gold: #ffd166;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* Several elements below set their own `display` (flex/inline-flex) via a class,
   which otherwise wins over the browser's default `[hidden] { display: none }` --
   this restores hidden's normal behavior regardless of what class is also present. */
[hidden] { display: none !important; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.92em;
}

body {
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 22px 30px 16px;
  font-size: 15px;
}

main {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Admin pages (not the login screen) use more of the window instead of the
   client dashboard's narrower reading-width cap. */
main.admin-main {
  max-width: none;
  width: 80%;
}

/* ---------- header ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.topbar h1 {
  font-size: 24px;
  margin: 0 0 5px 0;
  letter-spacing: 0.2px;
}

.subtitle {
  font-size: 13.5px;
  color: var(--text-dim);
}

.subtitle b { color: var(--blue); font-weight: 600; }

.actions { display: flex; gap: 10px; }

/* Every button gets its own colored border + faint tinted background (never the
   flat panel color, so it never blends into the card/row it sits on), and on
   hover the border thickens and the tint brightens. box-sizing: border-box
   (set globally above) means the thicker hover border doesn't shift layout. */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: 7px;
  padding: 11px 20px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s ease, border-color 0.15s ease, border-width 0.15s ease;
}

.btn-primary {
  background: var(--green-primary);
  border-color: var(--green-primary);
  color: var(--text);
}
.btn-primary:hover {
  background: var(--green-primary-hover);
  border-width: 2.5px;
}

.btn-secondary {
  background: rgba(167, 173, 184, 0.08);
  border-color: rgba(167, 173, 184, 0.35);
  color: var(--text);
}
.btn-secondary:hover {
  background: rgba(167, 173, 184, 0.16);
  border-width: 2.5px;
  border-color: rgba(167, 173, 184, 0.55);
}

.btn-download {
  background: rgba(79, 209, 139, 0.08);
  border-color: rgba(79, 209, 139, 0.4);
  color: var(--green);
}
.btn-download:hover {
  background: rgba(79, 209, 139, 0.16);
  border-width: 2.5px;
  border-color: rgba(79, 209, 139, 0.6);
}

.btn-danger {
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.4);
  color: var(--red);
}
.btn-danger:hover {
  background: rgba(255, 107, 107, 0.16);
  border-width: 2.5px;
  border-color: rgba(255, 107, 107, 0.6);
}

/* ---------- cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--border-card);
  border-radius: 10px;
  padding: 18px 20px 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-header h2 {
  font-size: 15px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  font-weight: 700;
}

.card-header-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 209, 102, 0.12);
  border-radius: 100px;
  padding: 4px 11px;
}

.count-accent {
  color: var(--gold);
  font-weight: 700;
}

/* ---------- file list / folder tree ---------- */

.file-empty {
  font-size: 13.5px;
  color: var(--text-faint);
  font-style: italic;
  padding: 6px 2px;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}

.tree-select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  cursor: pointer;
}

.tree-select-all input {
  accent-color: var(--blue);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.admin-help-text {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 6px 0 14px;
}

.btn-sm {
  font-size: 12.5px;
  padding: 7px 13px;
}

.file-tree {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 7px;
}

.tree-row:hover {
  background: #14171d;
}

.tree-toggle {
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  width: 22px;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.tree-toggle.is-expanded {
  transform: rotate(90deg);
}

.tree-file .tree-row {
  padding-left: 26px;
}

.tree-file .file-checkbox {
  accent-color: var(--green);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
}

.tree-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.tree-dir > .tree-row .tree-name {
  font-weight: 700;
}

.tree-meta {
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.tree-children {
  padding-left: 20px;
  border-left: 1px solid var(--border);
  margin-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zip-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 10px 36px;
  font-size: 12.5px;
}

.zip-progress-track {
  width: 140px;
  height: 6px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
  flex-shrink: 0;
}

.zip-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 0.2s ease;
}

.zip-status-text {
  color: var(--text-faint);
}

/* ---------- login ---------- */

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-main {
  width: 100%;
  max-width: 360px;
}

.login-card {
  display: flex;
  flex-direction: column;
}

.login-title {
  font-size: 22px;
  margin: 0 0 4px 0;
}

.login-card .subtitle {
  margin-bottom: 20px;
}

.login-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.login-input {
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  background: #14171d;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 12px;
  margin-bottom: 16px;
  outline: none;
}

.login-input:focus {
  border-color: var(--blue);
}

.login-btn {
  justify-content: center;
  margin-top: 4px;
}

.login-error {
  font-size: 13px;
  color: var(--red);
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 7px;
  padding: 9px 12px;
  margin: 0 0 16px 0;
}

/* ---------- admin ---------- */

.admin-flash {
  font-size: 13px;
  color: var(--green);
  background: rgba(79, 209, 139, 0.1);
  border: 1px solid rgba(79, 209, 139, 0.3);
  border-radius: 7px;
  padding: 9px 12px;
  margin-bottom: 16px;
}

.admin-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  background: #14171d;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.admin-row-main { flex: 1; min-width: 0; }

.admin-row-name {
  font-size: 14px;
  font-weight: 700;
}

.admin-row-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 6px;
}

.admin-row-meta code {
  color: var(--blue);
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Lets a <form> sit inline among the row's action buttons without disrupting
   the flex layout -- only its children (input + submit button) participate in it. */
.inline-action-form {
  display: contents;
}

.inline-password-input {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text);
  background: #14171d;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  width: 150px;
  flex-shrink: 0;
}

.inline-password-input:focus {
  border-color: var(--blue);
  outline: none;
}

.admin-row-wrap {
  display: flex;
  flex-direction: column;
}

.sync-path-text {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
}

.sync-path-text.sync-path-unset {
  color: var(--text-faint);
  font-family: inherit;
  font-size: 12.5px;
  font-style: italic;
}

.sync-cmd-fallback {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-all;
}

.admin-form {
  display: flex;
  flex-direction: column;
}

.admin-form .login-btn {
  margin-top: 4px;
  align-self: flex-start;
  padding-left: 28px;
  padding-right: 28px;
}

.credentials-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.credentials-box pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  background: #14171d;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
  white-space: pre-wrap;
  margin: 0;
}

.credentials-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: #14171d;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 12px 14px;
}

.cred-line {
  line-height: 1.6;
}

.cred-spacer {
  height: 10px;
}

.cred-label {
  color: var(--text-faint);
  font-size: 13px;
}

.cred-value {
  color: #ffffff;
  font-weight: 700;
  font-size: 19.5px;
}

.credentials-copy-btn {
  align-self: flex-start;
}

.slug-input-group {
  display: flex;
  margin-bottom: 16px;
}

.slug-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: var(--panel-hover);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 7px 0 0 7px;
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  white-space: nowrap;
}

.slug-input-group .login-input {
  border-radius: 0 7px 7px 0;
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.password-input-group {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.password-input-group .login-input {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.password-input-group .btn {
  flex-shrink: 0;
}
