:root {
    --uom-purple: #660099;
    --uom-purple-dark: #4d0073;
    --uom-purple-50: #f7f0fb;
    --ink: #1f2430;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f7f7fa;
    --card: #ffffff;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.08);
    --radius: 12px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
        "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 16px;
    line-height: 1.5;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
a { color: var(--uom-purple); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.app-loading {
    display: flex;
    height: 100vh;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

/* ---------- Top bar ---------- */
.topbar {
    background: var(--uom-purple);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: var(--shadow);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 60px;
}

.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand span { font-weight: 300; opacity: 0.9; }

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex: 1 1 auto;
    flex-wrap: wrap;
}
.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.4rem 0.7rem;
    border-radius: 8px;
    font-size: 0.93rem;
    font-weight: 500;
}
.nav-links a:hover { background: rgba(255, 255, 255, 0.12); text-decoration: none; color: #fff; }
.nav-links a.active { background: rgba(255, 255, 255, 0.18); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 1rem; }
.user-name { color: #fff; font-size: 0.9rem; font-weight: 500; }

.dev-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.dev-toggle input { accent-color: #fff; cursor: pointer; }

.btn-link {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
}
.btn-link:hover { opacity: 0.85; }

/* in-content link buttons (dashboard/back) revert to purple */
.table-wrap .btn-link,
.filter-controls .btn-link,
.review-top .btn-link { color: var(--uom-purple); }

/* ---------- Page scaffolding ---------- */
.page-head { padding: 2rem 0 1rem; }
.page-head h1 { font-size: 1.8rem; letter-spacing: -0.02em; }
.subtle { color: var(--muted); margin: 0.25rem 0 0; }
.muted { color: var(--muted); }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.empty {
    background: var(--card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--muted);
}
.empty .btn-primary { margin-top: 1rem; }

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-block;
    background: var(--uom-purple);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 0.6rem 1.1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn-primary:hover { background: var(--uom-purple-dark); text-decoration: none; color: #fff; }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-secondary {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.5rem 1rem;
    font: inherit;
    cursor: pointer;
}
.btn-secondary:hover { background: #f3f4f6; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.tab-strip { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.tab {
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
    font: inherit;
    font-size: 0.88rem;
    color: var(--muted);
    cursor: pointer;
}
.tab:hover { background: var(--uom-purple-50); color: var(--uom-purple); }
.tab.active { background: var(--uom-purple); color: #fff; }

.filter-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.select, .input, .search, .textarea {
    font: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 0.5rem 0.7rem;
}
.select:focus, .input:focus, .search:focus, .textarea:focus {
    outline: none;
    border-color: var(--uom-purple);
    box-shadow: 0 0 0 3px rgba(102, 0, 153, 0.12);
}
.search { min-width: 200px; }

/* ---------- Card grid / suggestion cards ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.card-wrap { display: flex; flex-direction: column; }

.suggestion-card {
    text-align: left;
    width: 100%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font: inherit;
    color: inherit;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.suggestion-card:hover { border-color: #d6b3e6; box-shadow: 0 4px 12px rgba(102, 0, 153, 0.10); }
.suggestion-card.is-own { border-left: 3px solid var(--uom-purple); }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.card-title { font-size: 1.05rem; font-weight: 600; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 0.85rem; }

.category-chip {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--uom-purple);
    background: var(--uom-purple-50);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
}
.own-chip {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--uom-purple);
    border: 1px solid #d6b3e6;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.status-badge {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.card-detail {
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    background: #fcfcfd;
    padding: 1rem 1.25rem 1.25rem;
    margin-top: -8px;
}
.desc { white-space: pre-wrap; margin: 0.25rem 0 0; }
.detail-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 1rem 0 0.5rem;
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
    position: relative;
    padding: 0 0 1rem 1.25rem;
    border-left: 2px solid var(--border);
}
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.dot {
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--uom-purple);
    border: 2px solid #fff;
}
.t-row { display: flex; align-items: baseline; gap: 0.75rem; }
.t-status { font-weight: 600; }
.t-date { color: var(--muted); font-size: 0.85rem; }
.t-by { color: var(--muted); font-size: 0.8rem; }
.t-comment {
    margin: 0.35rem 0 0;
    color: #374151;
    font-style: italic;
    background: var(--uom-purple-50);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.5rem 0; }
.pager-info { color: var(--muted); font-size: 0.9rem; }

/* ---------- Forms ---------- */
.form { max-width: 640px; display: flex; flex-direction: column; gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.label { font-weight: 600; font-size: 0.9rem; }
.field-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.counter { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.input, .select, .textarea { width: 100%; }
.textarea { resize: vertical; }
.validation-message { color: #dc2626; font-size: 0.83rem; }
.form-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 9px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
}

/* ---------- Submit confirmation ---------- */
.confirm { max-width: 520px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.5rem 1.5rem; }
.confirm-check {
    width: 56px; height: 56px; border-radius: 50%;
    background: #f0fdf4; color: #16a34a;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; font-weight: 700;
    margin-bottom: 0.5rem;
}
.confirm-actions { display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; justify-content: center; }

/* ---------- My Ideas ---------- */
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.mine-card { padding: 0; overflow: hidden; }
.mine-head {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
}
.mine-head:hover { background: #fafafb; }
.mine-head-main { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.mine-head-main h3 { font-size: 1.02rem; font-weight: 600; }
.mine-head-meta { display: flex; align-items: center; gap: 0.75rem; white-space: nowrap; }
.chevron { color: var(--muted); }
.mine-body { padding: 0 1.25rem 1.25rem; border-top: 1px solid var(--border); }
.mine-body .desc { margin-top: 0.75rem; }

/* ---------- Admin table ---------- */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.admin-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #fbfbfd;
}
.admin-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fcfafd; }
.cell-title { font-weight: 600; max-width: 320px; }
.cell-actions { text-align: right; white-space: nowrap; }

/* ---------- Review ---------- */
.review-top { padding: 1.5rem 0 0.5rem; }
.review-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 1.25rem; align-items: start; }
.review-detail h1 { font-size: 1.4rem; margin-bottom: 0.75rem; }
.review-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.85rem; margin-bottom: 0.5rem; }
.review-panel { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 1rem; }
.review-panel h2 { font-size: 1.1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }

.toast { border-radius: 9px; padding: 0.6rem 0.8rem; font-size: 0.88rem; }
.toast-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.toast-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ---------- Blazor error UI ---------- */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fef2f2;
    color: #991b1b;
    padding: 0.75rem 1.25rem;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; float: right; }
#blazor-error-ui .reload { color: #991b1b; text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
    .card-grid { grid-template-columns: 1fr; }
    .review-grid { grid-template-columns: 1fr; }
    .review-panel { position: static; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .nav-links { display: none; }
}
