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

:root {
    --bg:      #0f1117;
    --surface: #1a1d27;
    --border:  #2e3147;
    --text:    #e8eaf0;
    --muted:   #8b90a8;
    --accent:  #5b6ef5;
    --error:   #e05c5c;
    --font:    system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    min-height: 100vh;
}

/* ── Login ── */
.login-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    gap: 2rem;
}

.login-wrap h1 {
    font-size: 2rem;
    letter-spacing: .05em;
    color: var(--accent);
}

.login-wrap form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

label {
    font-size: .875rem;
    color: var(--muted);
}

input[type="email"],
input[type="text"] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 1rem;
    padding: .6rem .75rem;
    width: 100%;
    outline: none;
}

input:focus {
    border-color: var(--accent);
}

button[type="submit"] {
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    padding: .65rem;
    width: 100%;
    margin-top: .25rem;
}

button[type="submit"]:hover { filter: brightness(1.1); }

.link-btn {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .875rem;
    text-decoration: underline;
    padding: 0;
    text-align: left;
}

.form-error {
    color: var(--error);
    font-size: .875rem;
    min-height: 1.25rem;
}

.form-hint {
    color: var(--muted);
    font-size: .875rem;
}

/* ── Dashboard ── */
.dashboard-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.dash-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.dash-header .brand { font-size: 1.25rem; color: var(--accent); font-weight: 600; }
.dash-user { margin-left: auto; color: var(--muted); font-size: .875rem; }

.dash-main {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 2rem;
}

.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    min-width: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.dash-card h2 { font-size: 1.1rem; }
.dash-card p  { color: var(--muted); font-size: .925rem; }

.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: .65rem 1.25rem;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    align-self: flex-start;
    margin-top: .25rem;
}

.btn-primary:hover { filter: brightness(1.1); }
.muted { color: var(--muted); }
.coming-soon { font-style: italic; font-size: .85rem; }

.full-width { flex: 1 1 100%; }

.dash-actions { flex: 1 1 100%; display: flex; justify-content: flex-end; }

.form-row {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
.req  { color: var(--error); }

input[type="file"] {
    color: var(--muted);
    font-size: .875rem;
}

.upload-success { color: #5bf5a0; font-size: .875rem; min-height: 1.25rem; }

.entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.entry-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    padding: .4rem .75rem;
    border-bottom: 1px solid var(--border);
}

.entry-table td {
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.entry-table tr:last-child td { border-bottom: none; }
.delete-btn { color: var(--error); }

/* ── Session ── */
.session-wrap {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.session-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .6rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: .9rem;
}

.session-bar .brand  { color: var(--accent); font-weight: 600; }
.session-state       { font-size: 1rem; color: var(--muted); margin: 0 auto; letter-spacing: .05em; }
.session-state.listening  { color: #5bf5a0; }
.session-state.processing { color: #f5c45b; }
.session-controls    { display: flex; align-items: center; gap: 1rem; }
.session-user        { color: var(--muted); font-size: .8rem; }

.display-area {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.display-idle {
    text-align: center;
    color: var(--muted);
}

.display-idle p  { font-size: 1.75rem; }
.display-idle strong { color: var(--text); }

.logout-link {
    color: var(--muted);
    font-size: .8rem;
    text-decoration: none;
}
.logout-link:hover { color: var(--text); }

/* ── Confirmation banner ── */
.confirm-banner {
    background: var(--surface);
    border-bottom: 1px solid var(--accent);
    color: var(--text);
    font-size: 1.1rem;
    padding: .75rem 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Viewer ── */
#viewer {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
}

#pdf-canvas {
    display: block;
    max-width: 100%;
}

#img-viewer {
    max-width: 100%;
    max-height: calc(100% - 56px);
    object-fit: contain;
}

.viewer-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: .6rem 1rem;
    background: rgba(0, 0, 0, 0.55);
    color: var(--muted);
    font-size: .875rem;
}

.viewer-nav button {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
    padding: .25rem .9rem;
    line-height: 1.6;
}

.viewer-nav button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.viewer-nav button:disabled { opacity: .3; cursor: default; }
