:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --ink: #111827;
    --muted: #667085;
    --muted-2: #98a2b3;
    --line: #e7eaf0;
    --line-strong: #d9dee8;
    --blue: #103f75;
    --blue-2: #165a9f;
    --blue-soft: #edf5ff;
    --green: #18794e;
    --green-soft: #ecf8f1;
    --amber: #a15c00;
    --amber-soft: #fff6e5;
    --red: #b42318;
    --red-soft: #fff1f0;
    --violet: #6941c6;
    --violet-soft: #f4f0ff;
    --shadow: 0 1px 2px rgba(16,24,40,.03), 0 8px 30px rgba(16,24,40,.04);
    --radius: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

svg {
    width: 20px;
    height: 20px;
    display: block;
}

.hidden {
    display: none !important;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(420px, 720px) minmax(420px, 1fr);
}

.login-panel {
    background: #fff;
    padding: 64px 76px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--blue);
    color: #fff;
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.login-content {
    max-width: 420px;
}

.login-content h1 {
    font-size: 38px;
    line-height: 1.08;
    margin: 0 0 14px;
    letter-spacing: -.04em;
    font-weight: 650;
}

.login-content p {
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 34px;
}

.code-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 9px;
}

.code-row {
    display: flex;
    gap: 10px;
}

.code-input {
    width: 100%;
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 12px;
    padding: 14px 15px;
    outline: none;
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 15px;
    transition: .2s;
}

.code-input:focus {
    border-color: #8eb5dd;
    box-shadow: 0 0 0 4px rgba(22,90,159,.08);
}

.login-visual {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 74% 28%, rgba(60,113,162,.18), transparent 28%),
        linear-gradient(150deg, #0e3157 0%, #153f67 48%, #0a2745 100%);
    color: #fff;
    padding: 72px;
    display: flex;
    align-items: end;
}

.login-visual::before,
.login-visual::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
}

.login-visual::before {
    width: 700px;
    height: 700px;
    left: -130px;
    top: -220px;
}

.login-visual::after {
    width: 440px;
    height: 440px;
    right: -170px;
    bottom: -100px;
}

.visual-copy {
    position: relative;
    z-index: 2;
    max-width: 520px;
}

.visual-kicker {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .15em;
    opacity: .65;
    margin-bottom: 18px;
}

.visual-copy h2 {
    font-size: 42px;
    line-height: 1.08;
    letter-spacing: -.045em;
    font-weight: 580;
    margin: 0 0 20px;
}

.visual-copy p {
    margin: 0;
    color: rgba(255,255,255,.68);
    max-width: 440px;
    line-height: 1.65;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    height: 70px;
    padding: 0 30px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left,
.topbar-right,
.brand-inline,
.user-inline {
    display: flex;
    align-items: center;
}

.topbar-left {
    gap: 24px;
}

.brand-inline {
    gap: 10px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.brand-inline .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}

.role-pill {
    color: var(--muted);
    font-size: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
}

.topbar-right {
    gap: 10px;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #475467;
    display: grid;
    place-items: center;
}

.icon-button:hover {
    background: #f3f5f7;
}

.notification-button {
    position: relative;
}

.notification-dot {
    width: 7px;
    height: 7px;
    background: #e5484d;
    border: 2px solid #fff;
    border-radius: 50%;
    position: absolute;
    right: 7px;
    top: 7px;
}

.user-inline {
    margin-left: 5px;
    gap: 10px;
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #eaf0f6;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.user-copy {
    line-height: 1.2;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
}

.user-role {
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}

.workspace {
    max-width: 1480px;
    margin: 0 auto;
    padding: 34px 34px 80px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 28px;
}

.page-heading h1 {
    margin: 0;
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -.035em;
}

.page-heading p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.heading-actions {
    display: flex;
    gap: 8px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
    border-radius: 10px;
    min-height: 40px;
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    transition: .15s ease;
}

.primary-button {
    background: var(--blue);
    color: #fff;
    border: 1px solid var(--blue);
}

.primary-button:hover {
    background: #0c3666;
}

.secondary-button {
    background: #fff;
    color: #344054;
    border: 1px solid var(--line-strong);
}

.secondary-button:hover {
    background: #f9fafb;
}

.ghost-button {
    border: 0;
    background: transparent;
    color: var(--blue);
}

.danger-button {
    color: #b42318;
    background: #fff;
    border: 1px solid #f0c4c0;
}

.primary-button svg,
.secondary-button svg,
.ghost-button svg,
.danger-button svg {
    width: 17px;
    height: 17px;
}

.quick-create {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.quick-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: var(--blue-soft);
    color: var(--blue);
    flex: 0 0 auto;
}

.quick-create input {
    flex: 1;
    border: 0;
    outline: none;
    font-size: 15px;
    min-width: 0;
}

.quick-hint {
    color: var(--muted-2);
    font-size: 12px;
    white-space: nowrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 17px;
    display: flex;
    gap: 13px;
    align-items: center;
}

.stat-icon {
    width: 37px;
    height: 37px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--blue);
}

.stat-icon svg {
    width: 18px;
    height: 18px;
}

.stat-value {
    font-size: 21px;
    font-weight: 650;
    letter-spacing: -.02em;
}

.stat-label {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.surface {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16,24,40,.025);
}

.list-toolbar {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.search-box {
    width: 290px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 9px;
    display: flex;
    align-items: center;
    padding: 0 11px;
    gap: 8px;
    color: var(--muted);
    background: #fff;
}

.search-box svg {
    width: 16px;
    height: 16px;
}

.search-box input {
    border: 0;
    outline: none;
    width: 100%;
    background: transparent;
    font-size: 13px;
}

.segmented {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #f5f6f7;
    padding: 3px;
    border-radius: 9px;
}

.segmented button {
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 600;
}

.segmented button.active {
    background: #fff;
    color: var(--ink);
    box-shadow: 0 1px 3px rgba(16,24,40,.08);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 11px 16px;
    color: var(--muted);
    font-weight: 600;
    font-size: 10px;
    letter-spacing: .02em;
    text-align: left;
    background: #fafbfc;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid #eef0f3;
    font-size: 12px;
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #fafbfd;
}

.company-cell {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 190px;
}

.company-logo {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--blue);
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 11px;
}

.company-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.company-name {
    font-weight: 650;
    color: #1d2939;
}

.company-meta {
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
}

.status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 650;
    white-space: nowrap;
}

.status-blue {
    color: #175cd3;
    background: #eff6ff;
}

.status-green {
    color: #18794e;
    background: #ecf8f1;
}

.status-amber {
    color: #a15c00;
    background: #fff6e5;
}

.status-red {
    color: #b42318;
    background: #fff1f0;
}

.status-violet {
    color: #6941c6;
    background: #f4f0ff;
}

.status-gray {
    color: #475467;
    background: #f2f4f7;
}

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

.row-action {
    border: 1px solid var(--line-strong);
    background: #fff;
    border-radius: 8px;
    padding: 7px 10px;
    color: #344054;
    font-size: 11px;
    font-weight: 600;
}

.row-action.primary {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.empty-state {
    padding: 65px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--blue-soft);
    color: var(--blue);
    margin: 0 auto 14px;
}

.detail-header {
    margin-bottom: 22px;
}

.back-button {
    border: 0;
    background: transparent;
    padding: 0;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    margin-bottom: 18px;
}

.back-button svg {
    width: 16px;
    height: 16px;
}

.detail-title-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.detail-title-row .company-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
}

.detail-title {
    flex: 1;
}

.detail-title h1 {
    margin: 0;
    font-size: 27px;
    letter-spacing: -.035em;
}

.detail-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.process-steps {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
}

.process-step {
    border: 0;
    background: transparent;
    padding: 13px 2px;
    margin-right: 30px;
    color: var(--muted);
    position: relative;
    font-size: 12px;
    font-weight: 600;
}

.process-step.active {
    color: var(--blue);
}

.process-step.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    bottom: -1px;
    border-radius: 2px;
    background: var(--blue);
}

.section-grid {
    display: grid;
    grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr);
    gap: 18px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.card + .card {
    margin-top: 16px;
}

.card-header {
    padding: 17px 18px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-heading-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: var(--blue-soft);
}

.card-heading-icon svg {
    width: 17px;
    height: 17px;
}

.card-title {
    font-size: 13px;
    font-weight: 650;
}

.card-subtitle {
    color: var(--muted);
    font-size: 10px;
    margin-top: 2px;
}

.card-body {
    padding: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 15px;
}

.form-grid.three {
    grid-template-columns: repeat(3,minmax(0,1fr));
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    display: block;
    font-size: 10px;
    font-weight: 650;
    color: #475467;
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    outline: none;
    padding: 10px 11px;
    color: var(--ink);
    font-size: 12px;
    transition: .15s;
}

.field input,
.field select {
    min-height: 39px;
}

.field textarea {
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: #8bb4da;
    box-shadow: 0 0 0 3px rgba(22,90,159,.07);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    background: #f8f9fb;
    color: #667085;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 17px;
}

.contact-list,
.activity-list,
.document-list {
    display: flex;
    flex-direction: column;
}

.contact-item,
.activity-item,
.document-item {
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.contact-item:last-child,
.activity-item:last-child,
.document-item:last-child {
    border-bottom: 0;
}

.contact-top,
.activity-top,
.document-top {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.contact-name,
.activity-title,
.document-title {
    font-size: 12px;
    font-weight: 650;
}

.contact-detail,
.activity-detail,
.document-detail {
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px;
    line-height: 1.5;
}

.timeline-date {
    color: var(--muted-2);
    font-size: 9px;
    white-space: nowrap;
}

.next-action {
    margin-top: 9px;
    border-radius: 9px;
    background: var(--blue-soft);
    padding: 9px 10px;
    font-size: 10px;
    color: #275d8f;
}

.drop-zone {
    border: 1px dashed #b8c7d7;
    background: #fafcff;
    border-radius: 11px;
    padding: 24px 14px;
    text-align: center;
}

.drop-zone-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue);
    display: grid;
    place-items: center;
    margin: 0 auto 9px;
}

.drop-zone-title {
    font-weight: 650;
    font-size: 11px;
}

.drop-zone-copy {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.file-input {
    margin-top: 12px;
}

.workflow-actions {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.calendar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-item {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 15px;
    display: grid;
    grid-template-columns: 58px minmax(0,1fr) auto;
    gap: 16px;
    align-items: center;
}

.calendar-date {
    border-right: 1px solid var(--line);
    text-align: center;
    padding-right: 15px;
}

.calendar-day {
    font-size: 22px;
    font-weight: 700;
}

.calendar-month {
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.calendar-title {
    font-weight: 650;
    font-size: 12px;
}

.calendar-meta {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
}

.notification-panel {
    position: fixed;
    top: 76px;
    right: 24px;
    width: 360px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: 0 24px 60px rgba(16,24,40,.14);
}

.notification-header {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    font-weight: 650;
    font-size: 13px;
}

.notification-item {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-title {
    font-size: 11px;
    font-weight: 650;
}

.notification-message {
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.45;
}

.notification-time {
    font-size: 9px;
    color: var(--muted-2);
    margin-top: 6px;
}

.modal-layer {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.28);
    backdrop-filter: blur(3px);
    display: grid;
    place-items: center;
    padding: 22px;
    z-index: 200;
}

.modal {
    width: min(620px,100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(16,24,40,.22);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 15px;
    font-weight: 650;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

#toast-root {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    width: 310px;
    padding: 13px 14px;
    border-radius: 11px;
    background: #17212f;
    color: #fff;
    box-shadow: 0 12px 30px rgba(16,24,40,.18);
    font-size: 11px;
    animation: toast-in .22s ease;
}

.toast.error {
    background: #8d2924;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .section-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-visual {
        display: none;
    }

    .login-panel {
        min-height: 100vh;
    }
}

@media (max-width: 720px) {
    .workspace {
        padding: 24px 16px 60px;
    }

    .topbar {
        padding: 0 16px;
    }

    .user-copy,
    .role-pill {
        display: none;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .quick-hint {
        display: none;
    }

    .form-grid,
    .form-grid.three {
        grid-template-columns: 1fr;
    }

    .calendar-item {
        grid-template-columns: 50px minmax(0,1fr);
    }

    .calendar-item > :last-child {
        grid-column: 2;
    }

    .notification-panel {
        left: 12px;
        right: 12px;
        width: auto;
    }
}
