html, body {
    margin: 0;
    font-family: Inter, "Segoe UI", sans-serif;
    background: #f4f6fb;
    color: #1f2430;
}

/* Blazor's FocusOnNavigate moves keyboard focus to the page h1 after each
   navigation for screen-reader users. The focus itself is still applied
   (so assistive tech announces the new page), but we suppress the visible
   outline entirely since it reads as an accidental selection. */
h1:focus,
h1:focus-visible {
    outline: none;
    box-shadow: none;
}

a {
    text-decoration: none;
}

.admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.admin-sidebar {
    background: linear-gradient(165deg, #0f4c81, #1f2937);
    color: #fff;
    padding: 1.5rem 1.25rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.brand-header p {
    margin: 0.35rem 0 1.5rem;
    opacity: 0.8;
    font-size: 0.9rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-nav-group {
    margin: 0.95rem 0 0.15rem;
    padding: 0 0.8rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
}

.admin-nav-group:first-child {
    margin-top: 0;
}

.admin-nav-link {
    color: #dbeafe;
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    transition: background-color 0.2s;
}

.admin-nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.admin-main {
    padding: 1.5rem;
}

.admin-content {
    max-width: 1200px;
}

/* Template editor needs horizontal room for side-by-side source + preview */
.admin-content:has(.tpl-page) {
    max-width: min(1680px, 100%);
}

.landing-shell {
    min-height: 100vh;
    background: radial-gradient(circle at top right, #dbeafe, #f8fafc 50%);
    padding: 3rem 2rem;
}

.landing-hero {
    max-width: 900px;
    margin: 0 auto 2rem;
}

.landing-hero h1 {
    margin: 1rem 0;
    font-size: clamp(2rem, 6vw, 3.25rem);
    line-height: 1.08;
}

.landing-hero p {
    font-size: 1.05rem;
    color: #334155;
    max-width: 65ch;
}

.landing-actions {
    margin-top: 1.25rem;
}

.landing-grid {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.landing-card {
    background: #fff;
    border-radius: 18px;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(15, 76, 129, 0.08);
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.bento-card {
    background: #fff;
    border-radius: 18px;
    padding: 1.15rem 1.25rem;
    box-shadow: 0 10px 30px rgba(15, 76, 129, 0.08);
}

/* Shared pill chip (used by feedback review and related admin surfaces) */
.pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    width: fit-content;
}

.pill-muted {
    background: #f1f5f9;
    color: #64748b;
}

.split-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.settings-form h2 {
    margin-top: 1.4rem;
}

.form-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-grid label {
    font-size: 0.85rem;
    color: #4b5563;
    display: block;
    margin-bottom: 0.35rem;
}

.plain-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* Drag-and-drop reorderable card lists (catalog admin pages) */
.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.sortable-hint {
    margin: 0 0 0.15rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.sortable-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 0.75rem;
    padding: 0.85rem 0.95rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 76, 129, 0.05);
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.12s ease, opacity 0.12s ease;
}

.sortable-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 8px 20px rgba(15, 76, 129, 0.08);
}

.sortable-card.is-dragging {
    opacity: 0.55;
    cursor: grabbing;
    transform: scale(0.99);
    border-color: #93c5fd;
    box-shadow: 0 12px 28px rgba(15, 76, 129, 0.14);
}

.sortable-card.is-drop-target {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.sortable-card.is-selected {
    border-color: #0f4c81;
    background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
    box-shadow: 0 0 0 1px rgba(15, 76, 129, 0.2), 0 8px 20px rgba(15, 76, 129, 0.08);
}

.sortable-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    color: #94a3b8;
    padding-top: 0.15rem;
}

.sortable-grip {
    display: block;
    width: 12px;
    height: 18px;
    background-image:
        radial-gradient(circle, currentColor 1.4px, transparent 1.5px),
        radial-gradient(circle, currentColor 1.4px, transparent 1.5px);
    background-size: 6px 6px;
    background-position: 0 0, 6px 0;
    background-repeat: repeat-y;
    opacity: 0.85;
}

.sortable-body {
    min-width: 0;
}

.sortable-title {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    color: #0f4c81;
    font-weight: 650;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
}

.sortable-title:hover {
    color: #0b3a63;
    text-decoration: underline;
}

.sortable-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.sortable-desc {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.35;
}

.sortable-actions {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    padding-top: 0.1rem;
}

.sortable-actions .btn {
    white-space: nowrap;
}

.status-message {
    margin-top: 0.8rem;
    color: #166534;
    font-weight: 600;
}

.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    color: #fff;
    font-weight: 600;
}

.app-toast.is-success {
    background: #166534;
}

.app-toast.is-error {
    background: #b91c1c;
}

.toast-dismiss {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}

/* Notification event preference toggles (Notification settings page) */
.notif-event-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notif-event-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(11rem, 14rem);
    gap: 1rem 1.25rem;
    align-items: start;
}

.notif-event-title {
    font-weight: 650;
    color: #1f2937;
    font-size: 0.98rem;
}

.notif-event-desc {
    margin: 0.3rem 0 0.45rem;
    font-size: 0.88rem;
    color: #4b5563;
    line-height: 1.4;
}

.notif-event-key {
    font-size: 0.72rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
}

.notif-event-control .form-select {
    max-width: 100%;
}

@media (max-width: 720px) {
    .notif-event-card {
        grid-template-columns: 1fr;
    }
}

.preview-frame {
    width: 100%;
    min-height: 420px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #fff;
}

.preview-sms {
    white-space: pre-wrap;
    background: #F4F6FB;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9rem;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: #f8fafc;
}

.auth-card {
    background: #fff;
    padding: 1.4rem;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.1);
    width: min(420px, 92vw);
}

.auth-card-wide {
    width: min(720px, 94vw);
}

.signin-failure {
    white-space: pre-wrap;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.85rem;
}

.signin-config code {
    white-space: nowrap;
}

#blazor-error-ui {
    background: #b91c1c;
    color: #fff;
}

@media (max-width: 940px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }
}
