@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
    --font: "DM Sans", system-ui, sans-serif;
    --ink: #14181f;
    --muted: #6d665c;
    --navy: #121a27;
    --navy-mid: #1b2638;
    --paper: #f3f0ea;
    --card: #ffffff;
    --line: #e6e0d6;
    --line-strong: #d7cfc3;
    --copper: #c36d2d;
    --copper-dark: #a35720;
    --copper-soft: #f8efe6;
    --teal: #2b6a66;
    --teal-soft: #e8f3f2;
    --sage: #3f7a4e;
    --gold: #b8892d;
    --danger: #b42318;
    --sidebar-width: 272px;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(20, 24, 31, .04), 0 12px 32px rgba(20, 24, 31, .05);
    --shadow-hover: 0 10px 30px rgba(20, 24, 31, .08);
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
    background:
        radial-gradient(1200px 400px at 100% -10%, rgba(195, 109, 45, .08), transparent 50%),
        var(--paper);
    font-family: var(--font);
    color: var(--ink);
    min-height: 100vh;
    letter-spacing: -.01em;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .page-title, .stat-value, .brand-title {
    letter-spacing: -.03em;
}

a { color: var(--copper-dark); text-decoration: none; }
a:hover { color: var(--copper); }

/* Auth
-------------------------------------------------- */
.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 10% 10%, rgba(195, 109, 45, .22), transparent 45%),
        radial-gradient(700px 400px at 90% 90%, rgba(43, 106, 102, .2), transparent 40%),
        linear-gradient(160deg, #0e1520 0%, #172233 55%, #1e2d3d 100%);
    font-family: var(--font);
}

.auth-card {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
    background: #fff;
}

.auth-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #e39a5a, var(--copper));
    color: #fff;
    font-weight: 700;
    letter-spacing: -.04em;
    box-shadow: 0 10px 24px rgba(195, 109, 45, .35);
}

/* Sidebar
-------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    background:
        linear-gradient(180deg, rgba(255,255,255,.03), transparent 18%),
        var(--navy);
    color: #c9d0da;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar .brand {
    padding: 1.35rem 1.2rem 1.1rem;
    display: flex;
    gap: .85rem;
    align-items: center;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(180deg, #e39a5a, var(--copper));
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 18px rgba(195, 109, 45, .28);
}

.sidebar .brand-title {
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.sidebar .brand-sub {
    color: #8b95a5;
    font-size: .72rem;
    font-weight: 500;
}

.sidebar-nav {
    padding: .4rem .85rem 1rem;
    overflow-y: auto;
    flex: 1;
}

.sidebar .nav-label {
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #7d8796;
    padding: 1rem .75rem .4rem;
    font-weight: 600;
}

.sidebar .nav-link {
    color: #c5ccd6;
    border-radius: 12px;
    padding: .62rem .8rem;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-size: .9rem;
    font-weight: 500;
    margin-bottom: .15rem;
    border: 1px solid transparent;
}

.sidebar .nav-link i {
    width: 1.15rem;
    text-align: center;
    opacity: .85;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
}

.sidebar .nav-link.active {
    background: linear-gradient(180deg, rgba(195, 109, 45, .18), rgba(195, 109, 45, .1));
    color: #fff;
    border-color: rgba(195, 109, 45, .28);
}

.sidebar .nav-link.active i { color: #e8b07a; }

.sidebar-foot {
    padding: 1rem 1.1rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,.06);
}

.btn-logout {
    width: 100%;
    border: 1px solid rgba(255,255,255,.1);
    background: transparent;
    color: #d5dbe3;
    border-radius: 12px;
    padding: .6rem .8rem;
    font-weight: 500;
    font-size: .88rem;
}

.btn-logout:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
}

/* Shell
-------------------------------------------------- */
.main-wrap {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: rgba(255,255,255,.78);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    padding: .85rem 1.6rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
}

.breadcrumb {
    --bs-breadcrumb-divider-color: #c4bbb0;
    margin-top: .1rem;
}

.breadcrumb-item,
.breadcrumb-item a {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
}

.breadcrumb-item.active { color: var(--ink); }

.user-chip {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .35rem .45rem .35rem .85rem;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(180deg, #1b2638, #121a27);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}

.content { padding: 1.6rem 1.7rem 2.5rem; }

/* Cards
-------------------------------------------------- */
.card {
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
    background: var(--card);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    padding: 1rem 1.15rem;
    font-weight: 600;
    color: var(--ink);
}

.card-body { padding: 1.15rem; }

.page-title {
    font-weight: 700;
    color: var(--ink);
}

.page-kicker {
    color: var(--muted);
    font-size: .86rem;
    font-weight: 500;
}

/* Buttons
-------------------------------------------------- */
.btn {
    font-family: var(--font);
    font-weight: 600;
    border-radius: 12px;
    padding: .55rem 1rem;
    letter-spacing: -.01em;
}

.btn-primary {
    background: linear-gradient(180deg, #d07a3a, var(--copper));
    border: 1px solid var(--copper-dark);
    color: #fff;
    box-shadow: 0 8px 16px rgba(195, 109, 45, .18);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(180deg, #c36d2d, var(--copper-dark));
    border-color: var(--copper-dark);
    color: #fff;
}

.btn-success {
    background: var(--teal);
    border-color: #245955;
}

.btn-success:hover { background: #245955; border-color: #1e4b48; }

.btn-secondary,
.btn-outline-secondary {
    background: #fff;
    border: 1px solid var(--line-strong);
    color: var(--ink);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: #f7f3ed;
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-outline-primary {
    border-color: #e4c4a6;
    color: var(--copper-dark);
    background: var(--copper-soft);
}

.btn-outline-primary:hover {
    background: var(--copper);
    border-color: var(--copper);
    color: #fff;
}

.btn-outline-dark {
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-sm { border-radius: 10px; padding: .35rem .7rem; font-size: .8rem; }

.btn-link { color: var(--muted); font-weight: 600; }

/* Forms — premium inputs
-------------------------------------------------- */
.form-label {
    font-weight: 600;
    font-size: .82rem;
    color: #3d3a35;
    margin-bottom: .4rem;
}

.form-control,
.form-select,
textarea.form-control {
    font-family: var(--font);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #fbfaf7;
    min-height: 44px;
    padding: .55rem .85rem;
    color: var(--ink);
    box-shadow: inset 0 1px 1px rgba(20, 24, 31, .02);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.form-control:hover,
.form-select:hover {
    border-color: #cfc5b6;
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: #d7a06a;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(195, 109, 45, .14);
    color: var(--ink);
}

.form-control:disabled,
.form-select:disabled {
    background: #f1eee8;
    color: #8a8378;
}

.form-check-input {
    width: 1.1rem;
    height: 1.1rem;
    border: 1.5px solid #cfc5b6;
    border-radius: 5px;
}

.form-check-input:checked {
    background-color: var(--copper);
    border-color: var(--copper);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(195, 109, 45, .14);
}

.form-text { color: var(--muted); }

/* Premium badges
-------------------------------------------------- */
.badge {
    font-family: var(--font);
    font-weight: 600;
    letter-spacing: .04em;
    padding: .42em .72em;
    border-radius: 999px;
    font-size: .68rem;
    text-transform: uppercase;
    border: 1px solid transparent;
    line-height: 1.2;
}

.badge.bg-primary {
    background: #edf1f8 !important;
    color: #29456f !important;
    border-color: #d3dcec;
}

.badge.bg-secondary {
    background: #f1eee9 !important;
    color: #5c574f !important;
    border-color: #e0dbd3;
}

.badge.bg-success {
    background: #e8f4ec !important;
    color: #21663a !important;
    border-color: #cfe4d6;
}

.badge.bg-danger {
    background: #fbeaea !important;
    color: #9b1c1c !important;
    border-color: #f0cfcf;
}

.badge.bg-warning,
.badge.bg-warning.text-dark {
    background: #f8efd8 !important;
    color: #8a5b12 !important;
    border-color: #ecd7a6;
}

.badge.bg-info,
.badge.bg-info.text-dark {
    background: var(--teal-soft) !important;
    color: #1d5854 !important;
    border-color: #c7e0dd;
}

.badge.bg-dark {
    background: #ece8e2 !important;
    color: #2b2925 !important;
    border-color: #ddd6cc;
}

/* Tables
-------------------------------------------------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }

.table thead th {
    background: #faf8f4;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #8a8278;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
    padding: .85rem 1rem;
}

.table tbody td {
    padding: .9rem 1rem;
    vertical-align: middle;
    border-color: #f0ebe3;
    color: #2c2a26;
}

.table tbody tr:hover { background: #fbfaf7; }

.table a { font-weight: 600; color: var(--ink); }
.table a:hover { color: var(--copper); }

/* Dashboard
-------------------------------------------------- */
.stat-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    overflow: hidden;
    height: 100%;
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-card .card-body {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.05rem;
}

.stat-icon.ink { background: #eceff5; color: #2a3d5c; }
.stat-icon.copper { background: var(--copper-soft); color: var(--copper-dark); }
.stat-icon.teal { background: var(--teal-soft); color: var(--teal); }
.stat-icon.sage { background: #e8f3ea; color: var(--sage); }
.stat-icon.gold { background: #f7efd8; color: #946b1d; }
.stat-icon.slate { background: #eeebe6; color: #444038; }

.stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.05;
    color: var(--ink);
}

.stat-card .stat-label {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    font-weight: 600;
    margin-bottom: .35rem;
}

.stage-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 1rem 1.05rem;
    height: 100%;
    box-shadow: var(--shadow);
}

.stage-card .stage-value {
    font-size: 1.45rem;
    font-weight: 700;
}

.stage-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: .4rem;
}

.flow-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem 0;
}

.flow-row + .flow-row { border-top: 1px solid #f0ebe3; }

.flow-meter {
    height: 6px;
    background: #efeae3;
    border-radius: 99px;
    overflow: hidden;
    width: 88px;
}

.flow-meter span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--copper), #e0a36a);
    border-radius: 99px;
}

.activity-item {
    display: flex;
    gap: .8rem;
    padding: .75rem 0;
}

.activity-item + .activity-item { border-top: 1px solid #f0ebe3; }

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--copper);
    margin-top: .4rem;
    box-shadow: 0 0 0 4px var(--copper-soft);
    flex-shrink: 0;
}

/* Workflow pills
-------------------------------------------------- */
.workflow-track {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}

.workflow-step {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    border-radius: 999px;
    padding: .4rem .9rem;
    font-size: .8rem;
    font-weight: 600;
}

.workflow-step.completed {
    background: #e8f4ec;
    border-color: #cfe4d6;
    color: #21663a;
}

.workflow-step.current {
    background: var(--copper-soft);
    border-color: #e4c4a6;
    color: var(--copper-dark);
}

.workflow-step.pending { background: #faf8f4; }

.workflow-arrow { color: #c4bbb0; }

.timeline {
    border-left: 2px solid #efeae3;
    margin-left: .75rem;
    padding-left: 1.25rem;
}

.timeline-item { position: relative; padding-bottom: 1.25rem; }

.timeline-item::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--copper);
    position: absolute;
    left: -1.6rem;
    top: .35rem;
    box-shadow: 0 0 0 4px var(--copper-soft);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.required::after {
    content: " *";
    color: var(--danger);
}

.nav-tabs {
    border-bottom: 1px solid var(--line);
    gap: .25rem;
}

.nav-tabs .nav-link {
    border: 0;
    color: var(--muted);
    font-weight: 600;
    border-radius: 10px 10px 0 0;
    padding: .7rem 1rem;
}

.nav-tabs .nav-link.active {
    color: var(--ink);
    background: transparent;
    box-shadow: inset 0 -2px 0 var(--copper);
}

.choice-card {
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    background: #fbfaf7;
    cursor: pointer;
    display: block;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.choice-card:hover {
    border-color: #d7a06a;
    background: #fff;
}

.choice-card:has(input:checked) {
    border-color: #d7a06a;
    background: var(--copper-soft);
    box-shadow: 0 0 0 4px rgba(195, 109, 45, .12);
}

.alert {
    border: 0;
    border-radius: 14px;
    font-weight: 500;
}

.alert-success { background: #e8f4ec; color: #21663a; }
.alert-danger { background: #fbeaea; color: #9b1c1c; }
.alert-info { background: var(--teal-soft); color: #1d5854; }

.pagination .page-link {
    border-radius: 10px !important;
    margin: 0 .15rem;
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 600;
}

.pagination .page-item.active .page-link {
    background: var(--copper);
    border-color: var(--copper);
}

.sidebar-toggle { display: none; }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.show { transform: translateX(0); }
    .main-wrap { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .content { padding: 1.1rem; }
}

.toast-container { z-index: 1090; }
