/* ── Variables ── */
:root {
  /* Identité Fokus IT — teal #00A8B0 + headers noir */
  --primary:       #00a8b0;
  --primary-dark:  #00888f;
  --primary-light: #d4f0f1;
  --nav-bg:        #0a0a0a;
  --success:       #059669;
  --success-light: #d1fae5;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --bg:            #f1f5f9;
  --card:          #ffffff;
  --text:          #0f172a;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --radius:        10px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 12px rgba(0,0,0,.08);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; font-size: 14px; }
input, textarea, select { font-family: inherit; font-size: 14px; }
label { display: block; font-weight: 500; margin-bottom: 5px; color: var(--text); }

/* ── Navbar (identité Fokus IT) ── */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 120px;
  background: var(--nav-bg);
  position: sticky; top: 0; z-index: 100;
}
.nav-brand {
  display: flex; align-items: center; gap: 20px;
}
.nav-brand a { text-decoration: none !important; display: flex; align-items: center; }
.nav-brand a:hover { text-decoration: none !important; }
.nav-brand a.nav-brand-sub { color: rgba(255,255,255,.85) !important; }
.nav-brand img { height: 64px; width: auto; display: block; }
.nav-brand-sub {
  font-size: 16px; font-weight: 600;
  color: rgba(255,255,255,.85);
  letter-spacing: .04em;
  padding-left: 20px;
  border-left: 1px solid rgba(255,255,255,.18);
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 6px 12px; border-radius: 6px;
  color: rgba(255,255,255,.7); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav-link.active { color: #fff; background: var(--primary); }
.btn-portail {
  padding: 7px 14px; border-radius: 6px;
  background: var(--primary); color: #fff !important;
  font-weight: 600; font-size: 16px; letter-spacing: .02em;
  text-decoration: none !important;
  transition: background .15s;
  margin-left: 4px;
}
.btn-portail:hover { background: var(--primary-dark); }
.nav-sep { width: 1px; height: 20px; background: rgba(255,255,255,.15); margin: 0 8px; }
.nav-user { font-size: 13px; color: rgba(255,255,255,.6); padding: 0 4px; }
.btn-logout {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.75);
  padding: 5px 12px; border-radius: 6px; font-size: 13px;
  transition: all .15s;
}
.btn-logout:hover {
  border-color: var(--danger); color: #fff; background: var(--danger);
}

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px; }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); }

/* ── App grid ── */
.app-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 740px) { .app-grid { grid-template-columns: 1fr; } }

/* ── Card ── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-header h3 { font-size: 15px; font-weight: 700; }

/* ── Form elements ── */
.form-group { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--text-muted); font-weight: 400; }

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,168,176,.18);
}
textarea { resize: vertical; min-height: 80px; }

.char-count { text-align: right; font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── File drop zone ── */
.file-drop {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 20px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
  color: var(--text-muted);
}
.file-drop:hover, .file-drop.drag-over {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary);
}
.file-drop svg { margin-bottom: 8px; opacity: .6; }
.file-drop p { font-size: 13px; margin: 2px 0; }
.file-drop .link { color: var(--primary); cursor: pointer; text-decoration: underline; }

.file-badge {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 7px 10px;
  background: var(--primary-light); border-radius: 6px;
  font-size: 13px; color: var(--primary); font-weight: 500;
}
.file-badge svg { flex-shrink: 0; }
.file-badge span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clear-btn {
  background: none; border: none; color: var(--primary); font-size: 14px;
  padding: 0 2px; line-height: 1; opacity: .7;
}
.clear-btn:hover { opacity: 1; }

/* ── Templates list ── */
.templates-list { display: flex; flex-direction: column; gap: 6px; }
.template-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 7px; border: 1.5px solid var(--border);
  cursor: pointer; transition: all .15s; background: #fff;
}
.template-item:hover { border-color: var(--primary); background: var(--primary-light); }
.template-item.selected { border-color: var(--primary); background: var(--primary-light); }
.template-item-icon { width: 28px; height: 28px; background: var(--primary-light); border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.template-item-icon svg { color: var(--primary); }
.template-item-body { flex: 1; min-width: 0; }
.template-item-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-item-meta { font-size: 11px; color: var(--text-muted); }
.badge-ready { display: inline-block; font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--success-light); color: var(--success); font-weight: 600; }
.badge-pending { display: inline-block; font-size: 10px; padding: 1px 5px; border-radius: 4px; background: var(--warning-light); color: var(--warning); font-weight: 600; }
.template-del { background: none; border: none; color: var(--text-muted); font-size: 14px; opacity: .5; padding: 2px 4px; }
.template-del:hover { opacity: 1; color: var(--danger); }

/* ── Upload form ── */
.upload-form {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; margin-bottom: 14px; background: var(--bg);
}
.btn-row { display: flex; gap: 8px; }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border: none; border-radius: 7px;
  background: var(--primary); color: #fff; font-weight: 600;
  transition: background .15s, transform .1s; cursor: pointer;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 15px; }
.btn-primary.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-convert { margin-top: 4px; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1.5px solid var(--border); border-radius: 7px;
  background: #fff; color: var(--text); font-weight: 500;
  transition: all .15s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); text-decoration: none; }
.btn-outline.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-outline.btn-xs { padding: 3px 8px; font-size: 12px; }

.btn-ghost { background: none; border: none; color: var(--text-muted); padding: 7px 12px; border-radius: 7px; font-weight: 500; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-ghost.btn-sm { padding: 5px 10px; font-size: 13px; }

.btn-success {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: 7px;
  background: var(--success); color: #fff; font-weight: 600; font-size: 13px;
  transition: opacity .15s; cursor: pointer; text-decoration: none;
}
.btn-success:hover { opacity: .88; text-decoration: none; }

/* ── Result cards ── */
.result-card {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; padding: 14px 16px; border-radius: 9px;
}
.result-ok { background: var(--success-light); color: var(--success); }
.result-err { background: var(--danger-light); color: var(--danger); }
.result-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.08); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.result-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.result-body strong { font-size: 14px; }
.result-body span { font-size: 12px; }

/* ── Alerts ── */
.alert { padding: 9px 12px; border-radius: 7px; font-size: 13px; margin-top: 10px; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #6ee7b7; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }

/* ── Empty state ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 32px 16px; color: var(--text-muted); text-align: center;
}
.empty-state svg { opacity: .3; }
.empty-state p { font-size: 13px; line-height: 1.6; }

/* ── Loading ── */
.loading-row { display: flex; align-items: center; gap: 8px; padding: 16px; color: var(--text-muted); font-size: 13px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 9px 12px;
  border-bottom: 2px solid var(--border);
  font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.nowrap { white-space: nowrap; }
.instr-cell { max-width: 200px; }
.wrap-cell { max-width: 220px; word-break: break-word; }

/* ── Badges ── */
.badge { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.badge-ok   { background: var(--success-light); color: var(--success); }
.badge-err  { background: var(--danger-light);  color: var(--danger); }
.badge-warn { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary); }

/* ── Auth pages ── */
.auth-body { background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-wrap { width: 100%; max-width: 400px; padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow-md); padding: 36px 32px; }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header svg { color: var(--primary); margin-bottom: 10px; }
.auth-header h1 { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.auth-header p { color: var(--text-muted); font-size: 13px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }
.btn-block { width: 100%; justify-content: center; margin-top: 4px; }

/* ── Admin table ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left; padding: 9px 12px;
  border-bottom: 2px solid var(--border);
  font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.admin-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg); }
.admin-table .row-inactive td { opacity: .5; }
.actions-cell { display: flex; gap: 6px; flex-wrap: nowrap; }

.badge-admin { background: #ede9fe; color: #7c3aed; }
.badge-user  { background: var(--primary-light); color: var(--primary); }
.badge-ok    { background: var(--success-light); color: var(--success); }
.badge-off   { background: var(--border); color: var(--text-muted); }

.btn-sm {
  padding: 4px 10px; border-radius: 5px; font-size: 12px; font-weight: 500;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn-secondary { background: var(--bg); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-light); border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.modal-content {
  background: #fff; border-radius: var(--radius); padding: 28px 32px;
  max-width: 440px; width: 90%; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 12px;
}
.modal-content h3 { font-size: 16px; font-weight: 700; }
.temp-password-box {
  font-family: monospace; font-size: 18px; letter-spacing: .1em;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 10px 16px; text-align: center;
  color: var(--text); user-select: all;
}
.modal-notice { font-size: 12px; color: var(--text-muted); }

/* ── Quota bar ── */
.quota-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 1.25rem; box-shadow: var(--shadow); }
.quota-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; font-size: 13px; font-weight: 500; }
.quota-label { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.quota-track { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.quota-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.quota-fill-warn { background: var(--warning); }
.quota-fill-over { background: var(--danger); }

/* ── Disk dir cards ── */
.disk-dir-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.disk-dir-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.disk-dir-title { font-weight: 600; font-size: 13px; }
.disk-dir-size { font-size: 13px; color: var(--text-muted); }
.disk-dir-actions { display: flex; gap: 8px; }

/* ── Auth notice ── */
.auth-notice { font-size: 13px; color: var(--text-muted); background: var(--warning-light); border: 1px solid #fcd34d; border-radius: 7px; padding: 9px 12px; margin-bottom: 16px; }

/* ── Utility ── */
.hidden { display: none !important; }
