/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:    #4F46E5;
    --brand-dk: #4338CA;
    --danger:   #DC2626;
    --success:  #16A34A;
    --bg:       #F9FAFB;
    --surface:  #FFFFFF;
    --border:   #E5E7EB;
    --text:     #111827;
    --muted:    #6B7280;
    --radius:   10px;
    --shadow:   0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
}

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(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout helpers ───────────────────────────────────────────────────────── */
.center-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.3px;
    color: var(--brand);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── User pill ────────────────────────────────────────────────────────────── */
.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px 4px 4px;
    font-size: 13px;
    font-weight: 500;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: var(--brand);
    color: #fff;
    transition: background .15s;
    text-decoration: none;
}
.btn:hover { background: var(--brand-dk); text-decoration: none; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-google {
    background: #fff;
    color: #374151;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 15px;
    padding: 11px 24px;
}
.btn-google:hover { background: #f3f4f6; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
}

.section-card { margin-bottom: 24px; }
.section-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ── Login card ───────────────────────────────────────────────────────────── */
.login-card {
    width: 100%;
    max-width: 380px;
    text-align: center;
    padding: 48px 36px;
}

.login-logo { margin-bottom: 20px; }

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.subtitle { color: var(--muted); font-size: 14px; margin-bottom: 28px; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}
.alert-success { background: #DCFCE7; color: #166534; border: 1px solid #BBF7D0; }
.alert-error   { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }

/* ── Page title ───────────────────────────────────────────────────────────── */
.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -.4px;
}

/* ── File grid (dashboard) ────────────────────────────────────────────────── */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.file-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    transition: box-shadow .15s, border-color .15s;
    color: var(--text);
    text-decoration: none;
}
.file-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.10);
    border-color: var(--brand);
    text-decoration: none;
}
.file-icon { color: var(--brand); }
.file-meta { display: flex; flex-direction: column; gap: 3px; }
.file-name { font-weight: 600; font-size: 14px; }
.file-date { font-size: 12px; color: var(--muted); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* ── Admin file rows ──────────────────────────────────────────────────────── */
.file-row {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: var(--bg);
}

.file-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.file-row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #E5E7EB;
    color: var(--muted);
    margin-left: 6px;
}
.badge-blue  { background: #DBEAFE; color: #1D4ED8; }
.badge-green { background: #DCFCE7; color: #166534; }

/* ── Collapsible (details/summary) ───────────────────────────────────────── */
.collapsible {
    margin-top: 10px;
    border-top: 1px solid var(--border);
    padding-top: 10px;
}
.collapsible summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    user-select: none;
    list-style: none;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before {
    content: '▶ ';
    font-size: 10px;
}
details[open] > summary::before { content: '▼ '; }

/* ── Perm form ────────────────────────────────────────────────────────────── */
.perm-form {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Share section ────────────────────────────────────────────────────────── */
.share-section { margin-top: 12px; }
.share-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
}
.share-link-box input {
    flex: 1;
    font-family: monospace;
    font-size: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 10px;
    color: var(--text);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.upload-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 200px; }

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.hint { font-weight: 400; color: var(--muted); }

input[type="text"],
input[type="email"],
input[type="file"],
textarea {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    width: 100%;
    transition: border-color .15s;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
textarea { resize: vertical; font-family: monospace; }

/* ── Error card ───────────────────────────────────────────────────────────── */
.error-card { max-width: 420px; text-align: center; }
.error-card h1 { font-size: 22px; margin-bottom: 10px; }

/* ── Misc ─────────────────────────────────────────────────────────────────── */
.muted  { color: var(--muted); }
.small  { font-size: 12px; }
