/* ==========================================================================
   Company Reminders — design tokens & components
   See STYLE_GUIDE.md for usage rules.
   ========================================================================== */

:root {
    /* Brand */
    --cr-primary: #2563eb;
    --cr-primary-hover: #1d4ed8;
    --cr-primary-soft: #eff6ff;

    /* Neutrals */
    --cr-navy: #0f172a;
    --cr-text: #1e293b;
    --cr-text-muted: #64748b;
    --cr-border: #e2e8f0;
    --cr-surface: #ffffff;
    --cr-bg: #f6f8fb;
    --cr-neutral-soft: #f1f5f9;

    /* Semantic */
    --cr-success: #047857;
    --cr-success-soft: #ecfdf5;
    --cr-warning: #b45309;
    --cr-warning-soft: #fffbeb;
    --cr-danger: #dc2626;
    --cr-danger-soft: #fef2f2;

    /* Shape & depth (flat: hairline borders, minimal shadow) */
    --cr-radius: 10px;
    --cr-radius-sm: 8px;
    --cr-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);

    --cr-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body {
    font-family: var(--cr-font);
    background-color: var(--cr-bg);
    color: var(--cr-text);
    font-size: 0.9375rem;
    -webkit-font-smoothing: antialiased;
    /* Footer sits at the viewport bottom even when content is short */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--cr-navy);
    font-weight: 600;
    letter-spacing: -0.01em;
}

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

a:hover {
    color: var(--cr-primary-hover);
}

.text-muted {
    color: var(--cr-text-muted) !important;
}

/* --------------------------------------------------------------------------
   Top navigation
   -------------------------------------------------------------------------- */

.cr-navbar {
    background: var(--cr-surface);
    border-bottom: 1px solid var(--cr-border);
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
}

.cr-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--cr-navy);
    font-weight: 700;
    font-size: 1rem;
}

.cr-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--cr-primary);
    color: #fff;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.cr-navbar .nav-link {
    color: var(--cr-text-muted);
    font-weight: 500;
    padding: 0.5rem 0.875rem;
    border-radius: var(--cr-radius-sm);
}

.cr-navbar .nav-link:hover {
    color: var(--cr-navy);
    background: var(--cr-neutral-soft);
}

.cr-navbar .nav-link.active {
    color: var(--cr-primary);
    background: var(--cr-primary-soft);
}

/* --------------------------------------------------------------------------
   Page scaffolding
   -------------------------------------------------------------------------- */

.cr-main {
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    width: 100%;
    flex: 1;
}

.cr-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.cr-page-header h1 {
    font-size: 1.375rem;
    margin: 0;
}

.cr-page-header .cr-page-sub {
    color: var(--cr-text-muted);
    font-size: 0.875rem;
    margin: 0.125rem 0 0;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
    border: 1px solid var(--cr-border);
    border-radius: var(--cr-radius);
    box-shadow: var(--cr-shadow);
    background: var(--cr-surface);
}

.card-header {
    background: var(--cr-surface);
    border-bottom: 1px solid var(--cr-border);
    border-radius: var(--cr-radius) var(--cr-radius) 0 0 !important;
    padding: 0.875rem 1.125rem;
}

.card-header h2,
.card-header h5 {
    font-size: 0.9375rem;
    margin: 0;
}

.card-header .cr-count {
    color: var(--cr-text-muted);
    font-weight: 500;
}

/* KPI stat cards */
.cr-stat {
    padding: 1rem 1.125rem;
}

.cr-stat .cr-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cr-text-muted);
    margin-bottom: 0.25rem;
}

.cr-stat .cr-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--cr-navy);
    line-height: 1.2;
}

.cr-stat .cr-stat-hint {
    font-size: 0.8125rem;
    color: var(--cr-text-muted);
}

/* --------------------------------------------------------------------------
   Buttons — flat, one primary per view
   -------------------------------------------------------------------------- */

.btn {
    font-weight: 500;
    border-radius: var(--cr-radius-sm);
    font-size: 0.875rem;
    padding: 0.5rem 0.875rem;
}

.btn-primary {
    background: var(--cr-primary);
    border-color: var(--cr-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--cr-primary-hover);
    border-color: var(--cr-primary-hover);
}

.btn-outline-primary {
    color: var(--cr-primary);
    border-color: var(--cr-border);
}

.btn-outline-primary:hover {
    background: var(--cr-primary-soft);
    border-color: var(--cr-primary);
    color: var(--cr-primary);
}

.btn-outline-danger {
    color: var(--cr-danger);
    border-color: var(--cr-border);
}

.btn-outline-danger:hover {
    background: var(--cr-danger-soft);
    border-color: var(--cr-danger);
    color: var(--cr-danger);
}

.btn-secondary,
.btn-outline-secondary {
    color: var(--cr-text);
    background: var(--cr-surface);
    border-color: var(--cr-border);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: var(--cr-neutral-soft);
    border-color: var(--cr-border);
    color: var(--cr-navy);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--cr-navy);
    margin-bottom: 0.375rem;
}

.form-control {
    border: 1px solid var(--cr-border);
    border-radius: var(--cr-radius-sm);
    padding: 0.5625rem 0.75rem;
    font-size: 0.9375rem;
    color: var(--cr-text);
}

.form-control:focus {
    border-color: var(--cr-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-text {
    color: var(--cr-text-muted);
    font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Status pills — the only colour-coded element
   -------------------------------------------------------------------------- */

.status-pill {
    display: inline-block;
    padding: 0.1875rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.status-pending  { color: var(--cr-warning); background: var(--cr-warning-soft); }
.status-verified { color: var(--cr-success); background: var(--cr-success-soft); }
.status-inactive { color: var(--cr-text-muted); background: var(--cr-neutral-soft); }
.status-overdue  { color: var(--cr-danger); background: var(--cr-danger-soft); }
.status-active   { color: var(--cr-success); background: var(--cr-success-soft); }

/* --------------------------------------------------------------------------
   Entity rows (officers, PSCs, reminders, search results)
   -------------------------------------------------------------------------- */

.cr-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cr-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid var(--cr-border);
}

.cr-row:last-child {
    border-bottom: 0;
}

.cr-row-main {
    min-width: 0;
    flex: 1 1 16rem;
}

.cr-row-title {
    font-weight: 600;
    color: var(--cr-navy);
    font-size: 0.9375rem;
}

.cr-row-meta {
    color: var(--cr-text-muted);
    font-size: 0.8125rem;
    margin-top: 0.125rem;
}

.cr-row-status {
    font-size: 0.8125rem;
    margin-top: 0.375rem;
}

.cr-row-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    align-items: center;
}

/* Empty states */
.cr-empty {
    text-align: center;
    padding: 2.5rem 1.25rem;
    color: var(--cr-text-muted);
}

.cr-empty i {
    font-size: 1.75rem;
    color: #cbd5e1;
    display: block;
    margin-bottom: 0.625rem;
}

.cr-empty p {
    margin-bottom: 1rem;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table {
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cr-text-muted);
    border-bottom: 1px solid var(--cr-border);
    padding: 0.625rem 1.125rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1.125rem;
    border-color: var(--cr-border);
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.alert {
    border-radius: var(--cr-radius-sm);
    border: 1px solid transparent;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
}

.alert-success {
    color: var(--cr-success);
    background: var(--cr-success-soft);
    border-color: #a7f3d0;
}

.alert-danger {
    color: var(--cr-danger);
    background: var(--cr-danger-soft);
    border-color: #fecaca;
}

/* --------------------------------------------------------------------------
   Auth pages (sign in / create account)
   -------------------------------------------------------------------------- */

.cr-auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: var(--cr-bg);
}

.cr-auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--cr-surface);
    border: 1px solid var(--cr-border);
    border-radius: 14px;
    box-shadow: var(--cr-shadow);
    padding: 2rem;
}

.cr-auth-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    justify-content: center;
    margin-bottom: 0.5rem;
    font-weight: 700;
    font-size: 1.0625rem;
    color: var(--cr-navy);
}

.cr-auth-sub {
    text-align: center;
    color: var(--cr-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.cr-auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--cr-text-muted);
}

/* --------------------------------------------------------------------------
   Account settings
   -------------------------------------------------------------------------- */

.cr-danger-card {
    border-color: #fecaca;
}

.cr-danger-card .card-header {
    border-bottom-color: #fecaca;
}

.cr-account-meta {
    font-size: 0.8125rem;
    margin-top: 1rem;
    text-align: right;
}

/* --------------------------------------------------------------------------
   Footer / version stamp
   -------------------------------------------------------------------------- */

footer.cr-footer {
    width: 100%;
    background: var(--cr-surface);
    border-top: 1px solid var(--cr-border);
    text-align: center;
    color: var(--cr-text-muted);
    font-size: 0.75rem;
    line-height: 1.7;
    margin: 0;
    padding: 0;
}

.cr-footer-inner {
    max-width: 1140px;
    margin: 0 auto;
    padding: 1.25rem 1rem;
}

.cr-footer-text {
    font-weight: 500;
    color: var(--cr-text);
    margin: 0;
}

.cr-footer-version {
    font-variant-numeric: tabular-nums;
    margin: 0;
}

/* On auth pages, pin the footer to the bottom; spacing comes from
   .cr-footer-inner so it matches the logged-in pages exactly */
footer.cr-footer.cr-footer-auth {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal-content {
    border: 1px solid var(--cr-border);
    border-radius: var(--cr-radius);
}

.modal-header,
.modal-footer {
    border-color: var(--cr-border);
}

.modal-title {
    font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 575.98px) {
    .cr-main {
        padding: 1rem 0.75rem 2.5rem;
    }

    .cr-page-header .btn {
        width: 100%;
    }

    .cr-row-actions {
        width: 100%;
    }

    .cr-row-actions .btn {
        flex: 1;
    }

    .cr-row-actions form {
        flex: 1;
        display: flex;
    }

    .cr-row-actions form .btn {
        flex: 1;
    }

    .cr-auth-card {
        padding: 1.5rem;
    }
}
