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

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e2e6ea;
  --primary: #4361ee;
  --primary-h: #3451d1;
  --secondary: #6c757d;
  --success: #2ecc71;
  --warning: #f39c12;
  --danger: #e74c3c;
  --text: #212529;
  --text-muted: #6c757d;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ── */
.navbar { background: var(--surface); border-bottom: 1px solid var(--border);
          padding: 0 1.5rem; height: 56px; display: flex; align-items: center;
          justify-content: space-between; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.brand { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1.2rem; }
.nav-links a { color: var(--text-muted); font-size: .9rem; }
.nav-links a:hover { color: var(--primary); text-decoration: none; }
.admin-link { color: var(--warning) !important; font-weight: 600; }
.btn-link { background: none; border: none; cursor: pointer; color: var(--text-muted);
            font-size: .9rem; padding: 0; }
.btn-link:hover { color: var(--danger); }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem;
       border-radius: var(--radius); border: 1px solid transparent; font-size: .875rem;
       font-weight: 500; cursor: pointer; white-space: nowrap; transition: filter .15s; }
.btn:hover { filter: brightness(.92); text-decoration: none; }
.btn-primary  { background: var(--primary);   color: #fff; }
.btn-secondary{ background: var(--secondary); color: #fff; }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-success  { background: var(--success); color: #fff; }
.btn-warning  { background: var(--warning); color: #fff; }
.btn-sm { padding: .25rem .55rem; font-size: .8rem; }
.btn-danger-sm { background: none; border: none; color: var(--danger); cursor: pointer;
                 font-size: .8rem; padding: .15rem .35rem; border-radius: 4px; }
.btn-danger-sm:hover { background: #fdecea; }

/* ── Auth ── */
.auth-box { max-width: 400px; margin: 5rem auto; background: var(--surface);
            border-radius: var(--radius); padding: 2.5rem; box-shadow: var(--shadow); }
.auth-box h1 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.auth-box label { display: flex; flex-direction: column; gap: .35rem;
                  font-size: .875rem; font-weight: 500; margin-bottom: 1rem; }
.auth-box input { padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 6px;
                  font-size: .95rem; outline: none; transition: border-color .15s; }
.auth-box input:focus { border-color: var(--primary); }
.auth-box .btn { width: 100%; justify-content: center; margin-top: .5rem; }
.auth-footer { margin-top: 1.25rem; font-size: .875rem; text-align: center; color: var(--text-muted); }

/* ── Alerts ── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .875rem; }
.alert-error   { background: #fdecea; color: #b71c1c; border: 1px solid #f5c6c6; }
.alert-success { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }

/* ── Card ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* ── Page header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.3rem; }

/* ── Quota bar ── */
.quota-bar { font-size: .8rem; color: var(--text-muted); text-align: right; }
.progress { height: 6px; background: var(--border); border-radius: 99px; margin-top: 4px; width: 140px; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 99px;
                 transition: width .3s; max-width: 100%; }

/* ── Toolbar ── */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.inline-form { display: inline-flex; align-items: center; gap: .5rem; }
.input-sm { padding: .35rem .6rem; border: 1px solid var(--border); border-radius: 6px;
            font-size: .875rem; outline: none; }
.input-sm:focus { border-color: var(--primary); }

/* ── Share panel ── */
.share-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
               padding: 1.25rem; margin-bottom: 1rem; }
.share-panel h3 { font-size: .95rem; margin-bottom: .75rem; }
.share-panel h4 { font-size: .875rem; margin: 1rem 0 .5rem; }
.share-panel select, .share-panel input[type="text"] {
  padding: .4rem .65rem; border: 1px solid var(--border); border-radius: 6px; font-size: .875rem;
  margin-bottom: .6rem; display: block; width: 100%; max-width: 320px; }
.perms { display: flex; gap: 1.25rem; margin-bottom: .75rem; font-size: .875rem; }
.perms label { display: flex; align-items: center; gap: .35rem; cursor: pointer; }
.share-list { list-style: none; font-size: .85rem; }
.share-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); display: flex;
                 align-items: center; gap: .5rem; }

/* ── File grid ── */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.file-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
             padding: .85rem; display: flex; flex-direction: column; align-items: center;
             gap: .4rem; text-align: center; position: relative; transition: box-shadow .15s; }
.file-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.file-icon { font-size: 2rem; line-height: 1; text-decoration: none; }
.file-name { font-size: .82rem; word-break: break-word; }
.file-name a { color: var(--text); }
.file-size { font-size: .75rem; color: var(--text-muted); }
.file-actions { display: flex; gap: .4rem; margin-top: .25rem; }
.delete-form { position: absolute; top: .4rem; right: .4rem; }
.empty-state { grid-column: 1/-1; text-align: center; color: var(--text-muted);
               padding: 3rem; font-size: .95rem; }

/* ── Tables ── */
.data-table, .info-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table th, .data-table td,
.info-table th, .info-table td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th, .info-table th { font-weight: 600; background: var(--bg); }
.data-table tr:hover td { background: #f8f9ff; }
tr.banned td { color: var(--text-muted); background: #fff8f8; }

/* ── Badges ── */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-ok     { background: #e8f5e9; color: #2e7d32; }
.badge-danger { background: #fdecea; color: #c62828; }

/* ── Forms ── */
form label { display: flex; flex-direction: column; gap: .3rem; font-size: .875rem;
             font-weight: 500; margin-bottom: .85rem; }
form input[type="text"], form input[type="password"], form input[type="email"],
form input[type="number"], form select {
  padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 6px;
  font-size: .9rem; outline: none; transition: border-color .15s; }
form input:focus, form select:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem 1rem; align-items: end; }
.form-group { margin-bottom: 1rem; }
.radio-group { display: flex; flex-direction: column; gap: .5rem; margin-top: .35rem; }
.radio-group label { flex-direction: row; align-items: center; font-weight: 400; gap: .5rem; }

/* ── Admin stats ── */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
             padding: 1.25rem; text-align: center; box-shadow: var(--shadow); }
.stat-label { display: block; font-size: .8rem; color: var(--text-muted); margin-bottom: .4rem; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.admin-nav { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }

/* ── Groups ── */
.group-list { list-style: none; }
.group-list li { padding: .55rem 0; border-bottom: 1px solid var(--border);
                 display: flex; align-items: center; justify-content: space-between; }

/* ── User suggestions ── */
#user-suggestions { position: absolute; background: var(--surface); border: 1px solid var(--border);
                    border-radius: var(--radius); z-index: 10; min-width: 200px; box-shadow: var(--shadow); }
.suggestion-item:hover { background: var(--bg); }
