*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --success: #16a34a;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* NAV */
nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 60px; }
nav .brand { font-weight: 700; font-size: 1.1rem; color: var(--primary); text-decoration: none; }
nav .nav-right { display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
nav .nav-right a { color: var(--muted); text-decoration: none; }
nav .nav-right a:hover { color: var(--text); }
nav .nav-right .nav-user { color: var(--text); font-weight: 500; }

/* LAYOUT */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem; }
.page-header h1 { font-size: 1.4rem; font-weight: 700; }

/* CARD */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 1.5rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border-radius: var(--radius); border: none; cursor: pointer; font-size: .875rem; font-weight: 500; text-decoration: none; transition: background .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }

/* TABLE */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: .75rem 1rem; background: var(--bg); color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; color: var(--text); }
input[type=text], input[type=email], input[type=password], select {
  width: 100%; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .9rem; background: var(--surface); color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* FILE UPLOAD DROP ZONE */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 3rem 2rem; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: #eff6ff; }
.dropzone svg { width: 48px; height: 48px; color: var(--muted); margin-bottom: 1rem; }
.dropzone p { color: var(--muted); font-size: .9rem; }
.dropzone strong { color: var(--text); }
#file-input { display: none; }

/* PROGRESS */
.progress-wrap { margin-top: 1.5rem; display: none; }
.progress-item { margin-bottom: .75rem; }
.progress-info { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: .25rem; color: var(--muted); }
.progress-bar-track { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; width: 0; transition: width .1s; }

/* BREADCRUMB */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .875rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--muted); }

/* ALERTS */
.alert { padding: .75rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* FILE GRID */
.file-icon { width: 20px; height: 20px; flex-shrink: 0; }
.file-name-cell { display: flex; align-items: center; gap: .6rem; }
.folder-link { color: var(--primary); text-decoration: none; font-weight: 500; }
.folder-link:hover { text-decoration: underline; }

/* BADGE */
.badge { display: inline-block; padding: .2rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user { background: #dbeafe; color: #1e40af; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f1f5f9; color: var(--muted); }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card .card-body { padding: 2rem; }
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.login-logo p { color: var(--muted); font-size: .875rem; margin-top: .25rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; }
.stat-card .stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; margin-top: .25rem; }

/* PASSWORD TOGGLE */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-toggle { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; padding: .2rem; color: var(--muted); display: flex; align-items: center; }
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; pointer-events: none; }

/* UTILS */
.text-muted { color: var(--muted); }
.text-sm { font-size: .875rem; }
.flex { display: flex; }
.gap-2 { gap: .5rem; }
.mt-1 { margin-top: .25rem; }
.actions-cell { display: flex; gap: .4rem; }
