:root {
  --bg: #0d1012;
  --bg-panel: #12171a;
  --bg-panel-alt: #101416;
  --bg-input: #14181a;
  --border: #1c2225;
  --border-strong: #232a2d;
  --border-hover: #3a4448;
  --text: #e4eae6;
  --text-muted: #8b9a94;
  --text-dim: #6d7a75;
  --text-faint: #5f6b67;
  --accent: #5fd39a;
  --accent-hover: #77e0ac;
  --danger: #e0645f;
  --danger-bg: #241416;
  --danger-border: #4a2226;
  --danger-text: #f0b3b3;
  --success-bg: #12211a;
  --success-border: #234a35;
  --success-text: #9fe6c1;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: Barlow, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
input::placeholder { color: var(--text-faint); }

.mono { font-family: 'JetBrains Mono', monospace; }
.muted-dim { color: var(--text-dim); }
.hidden { display: none !important; }

.dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none; display: inline-block;
}
.dot-danger { background: var(--danger); }
.dot-accent { background: var(--accent); }

/* ===== Boutons ===== */
.btn {
  border-radius: 5px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: Barlow, sans-serif;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 14px;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--border-hover); color: var(--text); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  font-weight: 600;
}
.btn-danger:hover { background: #d9605b; }

/* ===== Ecran de connexion ===== */
.screen { min-height: 100vh; }

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card { width: 100%; max-width: 380px; }

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.brand-dot { width: 26px; height: 26px; background: var(--accent); border-radius: 3px; }
.brand-dot-sm { width: 18px; height: 18px; }
.brand-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.login-title { margin: 0 0 6px; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.login-subtitle { margin: 0 0 28px; color: #7e8b86; font-size: 14px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); font-family: 'JetBrains Mono', monospace;
}
.field input {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 11px 12px;
  color: var(--text);
  font-size: 15px;
  font-family: Barlow, sans-serif;
  outline: none;
  width: 100%;
}
.field input:focus { border-color: var(--accent); }

.error-banner {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: 5px;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--danger-text);
}
.error-banner .dot { margin-top: 6px; }

.login-footnote {
  margin-top: 22px;
  font-size: 12.5px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
}

/* ===== Barre superieure ===== */
.topbar { border-bottom: 1px solid var(--border); background: var(--bg-panel-alt); position: sticky; top: 0; z-index: 5; }
.topbar-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-server {
  font-family: 'JetBrains Mono', monospace; font-size: 11.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-dim);
  border-left: 1px solid var(--border-strong); padding-left: 10px;
}
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13.5px; color: var(--text-muted); }
.topbar-user { font-family: 'JetBrains Mono', monospace; }

/* ===== Contenu ===== */
.content { max-width: 1040px; margin: 0 auto; padding: 26px 24px 90px; display: flex; flex-direction: column; gap: 22px; }

.dropzone {
  border: 1px dashed var(--border-strong);
  background: var(--bg-panel-alt);
  border-radius: 8px;
  padding: 34px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dropzone.dragover { border-color: var(--accent); background: var(--success-bg); }
.dropzone-icon {
  width: 34px; height: 34px; border: 1px solid #2c3538; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 19px; line-height: 1;
}
.dropzone-title { font-size: 15.5px; font-weight: 500; }
.dropzone-sub { font-size: 13px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }

.stack { display: flex; flex-direction: column; gap: 8px; }

.error-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--danger-bg); border: 1px solid var(--danger-border);
  border-radius: 6px; padding: 11px 13px;
}
.error-row .dot { flex: none; }
.error-row-text { font-size: 14px; color: var(--danger-text); flex: 1; }
.error-row-text strong { font-family: 'JetBrains Mono', monospace; font-weight: 500; color: #fff; }
.error-dismiss {
  background: none; border: none; color: #a4756f; font-size: 16px; cursor: pointer;
  line-height: 1; padding: 2px 4px;
}
.error-dismiss:hover { color: var(--danger-text); }

.upload-row {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px;
}
.upload-row-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 14px; }
.upload-row-name { font-family: 'JetBrains Mono', monospace; font-size: 13.5px; }
.upload-row-label { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.upload-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.upload-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .2s linear; }

.toast {
  display: flex; align-items: center; gap: 11px;
  background: var(--success-bg); border: 1px solid var(--success-border);
  border-radius: 6px; padding: 11px 13px; font-size: 14px; color: var(--success-text);
}

.files-section { display: flex; flex-direction: column; gap: 0; }
.files-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 12px; }
.files-heading { display: flex; align-items: baseline; gap: 10px; }
.files-heading h2 { margin: 0; font-size: 16px; font-weight: 600; }

.search-input {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 5px;
  padding: 8px 11px; color: var(--text); font-size: 13.5px; font-family: Barlow, sans-serif;
  outline: none; width: 220px;
}
.search-input:focus { border-color: var(--border-hover); }

.files-table { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.files-row {
  display: grid; grid-template-columns: 1fr 150px 100px 40px; gap: 14px;
  align-items: center; padding: 11px 14px; border-bottom: 1px solid #171c1f;
}
.files-row:hover { background: #11171a; }
.files-row-head {
  padding: 9px 14px; background: var(--bg-panel-alt); border-bottom: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-faint);
}
.files-row-head:hover { background: var(--bg-panel-alt); }
.file-name { font-family: 'JetBrains Mono', monospace; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-date, .file-size { font-size: 13px; color: var(--text-muted); }
.file-size { text-align: right; font-family: 'JetBrains Mono', monospace; }
.file-delete {
  justify-self: end; background: none; border: 1px solid var(--border-strong); border-radius: 4px;
  color: #7d8b86; width: 28px; height: 28px; cursor: pointer; font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.file-delete:hover { border-color: #5a2a2e; color: var(--danger); }
.align-right { text-align: right; }

.files-empty { padding: 34px 14px; text-align: center; color: var(--text-faint); font-size: 14px; }

/* ===== Modal de confirmation ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6,8,9,.72);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 20;
}
.modal-card {
  width: 100%; max-width: 380px; background: var(--bg-panel);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-filename {
  font-size: 13px; color: var(--text-muted); background: var(--bg-panel-alt);
  border: 1px solid var(--border); border-radius: 5px; padding: 9px 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal-text { font-size: 13.5px; color: #7e8b86; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 2px; }

@media (max-width: 560px) {
  .files-row { grid-template-columns: 1fr 40px; }
  .file-date, .file-size, .files-row-head span:nth-child(2), .files-row-head span:nth-child(3) { display: none; }
  .search-input { width: 100%; }
  .files-header { flex-direction: column; align-items: stretch; }
}

/* ===== Panel admin ===== */
.admin-topbar-inner { max-width: 760px; }
.admin-content { max-width: 760px; }

.btn-inline { flex: none; width: auto; }
.btn-flex { flex: 1; }
.btn-self-start { align-self: flex-start; width: auto; }

.form-actions { display: flex; gap: 10px; margin-top: 2px; }

#admin-create-form, #admin-edit-form {
  max-width: 420px; margin: 0 auto; width: 100%;
  display: flex; flex-direction: column; gap: 14px;
}
#admin-create-form h2, #admin-edit-form h2 { margin: 0; font-size: 16px; font-weight: 600; }

.admin-form-wrap { max-width: 420px; margin: 0 auto; }
.admin-form-wrap > div:not(.hidden) { display: flex; flex-direction: column; gap: 16px; }

#change-pw-form { display: flex; flex-direction: column; gap: 14px; }
#change-pw-success { display: flex; flex-direction: column; gap: 16px; }

.accounts-table .files-row,
.accounts-row-head { grid-template-columns: 1fr 120px 210px; }

.account-username { display: flex; align-items: center; gap: 8px; }
.account-badge {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--success-border); border-radius: 3px; padding: 1px 5px;
}
.account-actions { display: flex; gap: 8px; justify-content: flex-end; }
.account-edit-btn {
  background: none; border: 1px solid var(--border-strong); border-radius: 4px; color: #9fb0aa;
  padding: 6px 9px; font-size: 12.5px; font-family: Barlow, sans-serif; cursor: pointer;
}
.account-edit-btn:hover { border-color: var(--border-hover); color: var(--text); }

.credentials-box {
  background: var(--bg-panel); border: 1px solid var(--border); border-radius: 7px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.credentials-field { display: flex; flex-direction: column; gap: 4px; }
.credentials-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.credentials-value { font-size: 15px; }
.credentials-row { display: flex; gap: 8px; }
.credentials-box-inline {
  background: var(--bg-panel-alt); border: 1px solid var(--border); border-radius: 5px;
  padding: 8px 11px; flex: 1;
}

.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13.5px; color: #c3cec9; cursor: pointer; }
.checkbox-row input { margin-top: 2px; accent-color: var(--danger); width: 15px; height: 15px; flex: none; }

#create-password, #edit-password { flex: 1; min-width: 0; }

@media (max-width: 560px) {
  .accounts-table { overflow-x: auto; }
  .accounts-table .files-row,
  .accounts-row-head { grid-template-columns: 1fr 90px 170px; width: max-content; min-width: 100%; }
}
