* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #f5f7fa;
    color: #172033;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 230px;
    background: #ffffff;
    border-right: 1px solid #e4e8ef;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 5px 8px 25px;
}

.brand strong {
    display: block;
    font-size: 18px;
}

.brand small {
    display: block;
    color: #7b8495;
    margin-top: 2px;
}

.brand-mark {
    width: 35px;
    height: 35px;
    border-radius: 9px;
    background: #1473e6;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
}

.brand-mark.large {
    width: 52px;
    height: 52px;
    margin: auto;
    font-size: 24px;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #445066;
    text-decoration: none;
    font-size: 14px;
}

.nav-item:hover {
    background: #f1f5fa;
}

.nav-item.active {
    background: #eaf3ff;
    color: #1263c4;
    font-weight: 600;
}

.nav-item.disabled {
    color: #9da5b3;
    cursor: default;
}

.sidebar-bottom {
    margin-top: auto;
}

.main {
    margin-left: 230px;
}

.topbar {
    height: 64px;
    background: white;
    border-bottom: 1px solid #e4e8ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.search {
    width: 360px;
    border: 1px solid #dce1e8;
    border-radius: 20px;
    padding: 9px 17px;
    color: #9ba3af;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
}

.logout {
    border: 0;
    background: transparent;
    color: #687386;
    cursor: pointer;
}

.content {
    padding: 30px;
}

.page-header h1 {
    margin: 0;
    font-size: 26px;
}

.page-header p {
    margin-top: 7px;
    color: #768195;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-top: 25px;
}

.stat-card {
    background: white;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    padding: 22px;
}

.stat-label {
    color: #667286;
    font-size: 14px;
}

.stat-number {
    font-size: 34px;
    font-weight: 600;
    margin-top: 8px;
}

.stat-card.blue {
    border-top: 3px solid #3887e8;
}

.stat-card.red {
    border-top: 3px solid #e45757;
}

.stat-card.green {
    border-top: 3px solid #36aa72;
}

.stat-card.gray {
    border-top: 3px solid #8e98a8;
}

.panel {
    background: white;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    margin-top: 24px;
    min-height: 420px;
}

.panel-header {
    padding: 18px 22px;
    border-bottom: 1px solid #e8ebf0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 17px;
    margin: 0;
}

.filters {
    display: flex;
    gap: 7px;
}

.filters button {
    background: white;
    border: 1px solid #dce1e8;
    border-radius: 7px;
    padding: 7px 12px;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    color: #778297;
    padding: 110px 20px;
}

.empty-icon {
    width: 55px;
    height: 55px;
    margin: auto;
    border-radius: 50%;
    background: #e7f6ee;
    color: #249c62;
    font-size: 30px;
    line-height: 55px;
}

.empty-state h3 {
    color: #344054;
    margin-bottom: 5px;
}


/* LOGIN */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f6fa;
}

.login-card {
    width: 390px;
    background: white;
    border: 1px solid #e1e6ed;
    border-radius: 12px;
    padding: 36px;
    box-shadow: 0 8px 30px rgba(0,0,0,.05);
}

.login-brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-brand h1 {
    margin: 12px 0 4px;
}

.login-brand p {
    color: #788397;
    font-size: 14px;
}

.login-card label {
    display: block;
    margin: 16px 0 6px;
    font-size: 14px;
    font-weight: 500;
}

.login-card input {
    width: 100%;
    border: 1px solid #ccd3dd;
    border-radius: 7px;
    padding: 11px;
    font-size: 15px;
}

.login-button {
    width: 100%;
    margin-top: 22px;
    padding: 11px;
    background: #1473e6;
    border: 0;
    border-radius: 7px;
    color: white;
    font-size: 15px;
    cursor: pointer;
}

.login-error {
    padding: 10px;
    background: #fff0f0;
    color: #b42318;
    border-radius: 6px;
    font-size: 14px;
}

@media (max-width: 900px) {
    .sidebar {
        width: 190px;
    }

    .main {
        margin-left: 190px;
    }

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

    .search {
        width: 220px;
    }
}

.filters a {
    background: white;
    border: 1px solid #dce1e8;
    border-radius: 7px;
    padding: 7px 12px;
    color: #344054;
    text-decoration: none;
    font-size: 13px;
}

.filters a:hover {
    background: #f3f6fa;
}

.task-list {
    width: 100%;
}

.task-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 22px;
    border-bottom: 1px solid #edf0f4;
}

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

.task-meta {
    margin-top: 5px;
    color: #7a8494;
    font-size: 13px;
}
/* SETTINGS */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 25px;
    max-width: 1000px;
}

.settings-card {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #fff;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    padding: 22px;
    text-decoration: none;
    color: #172033;
    transition: 0.15s ease;
}

a.settings-card:hover {
    border-color: #b8d4f6;
    box-shadow: 0 4px 16px rgba(20, 115, 230, 0.08);
    transform: translateY(-1px);
}

.settings-card-icon {
    width: 48px;
    height: 48px;
    background: #eaf3ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}

.settings-card h3 {
    margin: 0 0 5px;
    font-size: 16px;
}

.settings-card p {
    margin: 0;
    color: #768195;
    font-size: 13px;
}

.disabled-setting {
    opacity: 0.55;
}

.settings-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.back-link {
    display: inline-block;
    color: #1473e6;
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 9px;
}

.primary-button {
    background: #1473e6;
    color: #fff;
    border: 0;
    border-radius: 7px;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
}

.users-panel {
    min-height: 0;
    overflow: hidden;
}

.user-table {
    display: grid;
    grid-template-columns: 2fr 2fr 1.5fr 1fr 1.3fr;
    gap: 18px;
    align-items: center;
}

.user-table-header {
    padding: 12px 20px;
    background: #f8fafc;
    color: #687386;
    font-size: 12px;
    font-weight: 600;
    border-bottom: 1px solid #e8ebf0;
}

.user-table-row {
    min-height: 64px;
    padding: 10px 20px;
    border-bottom: 1px solid #edf0f4;
    font-size: 14px;
}

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

.user-name {
    display: flex;
    align-items: center;
    gap: 11px;
}

.user-name small {
    display: block;
    margin-top: 2px;
    color: #8992a1;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #eaf3ff;
    color: #1473e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.tag,
.status-pill,
.role-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 12px;
}

.tag {
    background: #f1f4f8;
    color: #536075;
}

.active-user {
    background: #e8f7ef;
    color: #197249;
}

.inactive-user {
    background: #f1f3f5;
    color: #687386;
}

.admin-role {
    background: #fff0ed;
    color: #b42318;
}

.user-role {
    background: #eaf3ff;
    color: #1263c4;
}

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

    .user-table {
        grid-template-columns: 2fr 2fr 1fr;
    }

    .user-table > :nth-child(3),
    .user-table > :nth-child(5) {
        display: none;
    }
}


/* ORDERS */

.page-header-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: #1473e6;
    color: #fff;
    border: 0;
    border-radius: 7px;
    padding: 10px 15px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.button-link.secondary {
    background: #fff;
    color: #344054;
    border: 1px solid #d9e0e8;
}

.order-filters {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(170px, 1fr) minmax(200px, 1.2fr) auto;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #e8ebf0;
}

.order-filters input,
.order-filters select,
.form-control {
    width: 100%;
    min-height: 40px;
    border: 1px solid #ccd4df;
    border-radius: 7px;
    padding: 9px 10px;
    background: #fff;
    color: #172033;
    font: inherit;
}

.order-filters button {
    min-height: 40px;
}

.order-result-count {
    padding: 10px 20px;
    color: #7a8494;
    font-size: 13px;
    border-bottom: 1px solid #edf0f4;
}

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

.order-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1050px;
}

.order-table th {
    text-align: left;
    padding: 11px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e7ee;
    color: #687386;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.order-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #edf0f4;
    font-size: 13px;
    vertical-align: middle;
}

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

.order-table tbody tr:hover {
    background: #fafcff;
}

.order-link {
    color: #1263c4;
    text-decoration: none;
    font-weight: 600;
}

.order-link:hover {
    text-decoration: underline;
}

.order-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 5px 9px;
    background: #f3f5f8;
    white-space: nowrap;
}

.order-status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-color, #6b7280);
}

.order-form-card {
    max-width: 1100px;
}

.form-section {
    padding: 22px;
    border-bottom: 1px solid #edf0f4;
}

.form-section:last-child {
    border-bottom: 0;
}

.form-section h2 {
    margin: 0 0 17px;
    font-size: 17px;
}

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

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

.form-field label {
    display: block;
    margin-bottom: 6px;
    color: #445066;
    font-size: 13px;
    font-weight: 600;
}

.form-field textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.field-error,
.form-errors {
    margin-top: 6px;
    color: #b42318;
    font-size: 12px;
}

.form-errors {
    margin: 0 22px 10px;
    padding: 10px 12px;
    background: #fff1f0;
    border-radius: 7px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 22px;
}

.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 0.9fr);
    gap: 20px;
    margin-top: 24px;
}

.detail-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-card {
    background: #fff;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    overflow: hidden;
}

.detail-card h2 {
    margin: 0;
    padding: 15px 18px;
    border-bottom: 1px solid #e8ebf0;
    font-size: 16px;
}

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

.detail-item {
    padding: 14px 18px;
    border-bottom: 1px solid #edf0f4;
}

.detail-item:nth-last-child(-n+2) {
    border-bottom: 0;
}

.detail-label {
    color: #7a8494;
    font-size: 12px;
    margin-bottom: 5px;
}

.detail-value {
    font-size: 14px;
    overflow-wrap: anywhere;
}

.status-form {
    display: flex;
    gap: 8px;
    padding: 16px 18px;
}

.status-form select {
    flex: 1;
}

.document-list,
.timeline-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.document-item {
    padding: 12px 18px;
    border-bottom: 1px solid #edf0f4;
}

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

.document-item a {
    color: #1263c4;
    text-decoration: none;
}

.timeline-item {
    position: relative;
    margin-left: 25px;
    padding: 0 18px 20px 24px;
    border-left: 2px solid #e5e9ef;
}

.timeline-item:first-child {
    padding-top: 18px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: -6px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #1473e6;
    border: 2px solid #fff;
}

.timeline-item:first-child::before {
    top: 22px;
}

.timeline-title {
    font-size: 13px;
    font-weight: 600;
}

.timeline-meta {
    margin-top: 4px;
    color: #8a94a4;
    font-size: 12px;
}

.timeline-description {
    margin-top: 6px;
    color: #5f6b7c;
    font-size: 13px;
}

.muted {
    color: #8a94a4;
}

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

    .detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .form-grid,
    .detail-grid,
    .order-filters {
        grid-template-columns: 1fr;
    }

    .page-header-row {
        align-items: stretch;
        flex-direction: column;
    }
}


/* TWO FACTOR */

.otp-card {
    width: 430px;
}

.otp-qr {
    display: flex;
    justify-content: center;
    margin: 18px 0;
}

.otp-qr img {
    width: 220px;
    height: 220px;
    background: #fff;
    border: 1px solid #e1e6ed;
    border-radius: 10px;
    padding: 10px;
}

.otp-secret {
    margin: 12px 0 18px;
    padding: 11px 12px;
    background: #f5f7fa;
    border-radius: 7px;
    text-align: center;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.otp-secret span {
    display: block;
    color: #778297;
    margin-bottom: 4px;
}

.otp-secret strong {
    letter-spacing: 1px;
}


/* UPDATE CENTER */

.settings-card-content {
    flex: 1;
    min-width: 0;
}

.settings-card-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.update-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
}

.update-badge.available {
    background: #fff3d6;
    color: #9a6700;
}

.update-badge.current {
    background: #e8f7ef;
    color: #197249;
}

.update-badge.setup {
    background: #f1f3f5;
    color: #687386;
}

.update-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr);
    gap: 20px;
    margin-top: 24px;
}

.update-state {
    margin: 18px;
    padding: 15px 16px;
    border-radius: 9px;
}

.update-state p {
    margin: 5px 0 0;
    font-size: 13px;
}

.update-state.available {
    background: #fff8e6;
    color: #805500;
}

.update-state.current {
    background: #eaf8f0;
    color: #17643f;
}

.update-state.working {
    background: #eaf3ff;
    color: #125aa7;
}

.update-state.warning {
    background: #fff1f0;
    color: #9f2d20;
}

.update-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: #edf0f4;
    border-top: 1px solid #edf0f4;
    border-bottom: 1px solid #edf0f4;
}

.update-info-grid.single {
    grid-template-columns: 1fr;
}

.update-info-grid > div {
    background: #fff;
    padding: 14px 18px;
}

.update-info-grid span {
    display: block;
    color: #7a8494;
    font-size: 12px;
    margin-bottom: 5px;
}

.update-info-grid strong {
    display: block;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.update-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px;
}

.update-actions form {
    margin: 0;
}

.update-actions button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.update-help {
    padding: 18px;
    color: #697586;
    font-size: 13px;
    line-height: 1.55;
}

.update-notice {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.update-notice.success {
    background: #eaf8f0;
    color: #17643f;
}

.update-notice.info {
    background: #eaf3ff;
    color: #125aa7;
}

.update-notice.error {
    background: #fff1f0;
    color: #9f2d20;
}

@media (max-width: 1000px) {
    .update-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .update-info-grid {
        grid-template-columns: 1fr;
    }
}


/* PARTNER DATABASE */
.partner-filters { display:grid; grid-template-columns:minmax(260px,2fr) minmax(180px,.8fr) auto; gap:10px; padding:16px 20px; border-bottom:1px solid #e8ebf0; }
.partner-filters input,.partner-filters select { width:100%; min-height:40px; border:1px solid #ccd4df; border-radius:7px; padding:9px 10px; background:#fff; color:#172033; font:inherit; }
.partner-table { min-width:980px; }
.partner-form-card { max-width:1180px; }
.checkbox-field { display:flex; align-items:center; gap:8px; min-height:40px; }
.checkbox-field input { width:auto; }
.checkbox-field label { margin:0; }
.partner-detail-layout { display:grid; grid-template-columns:minmax(0,2fr) minmax(320px,.9fr); gap:20px; margin-top:24px; }
.full-detail-item { grid-column:1/-1; }
.partner-contact { padding:14px 18px; border-bottom:1px solid #edf0f4; font-size:13px; line-height:1.55; }
.partner-contact strong { font-size:14px; margin-right:6px; }
.partner-contact-form { padding:16px 18px 18px; border-top:1px solid #edf0f4; }
.partner-contact-form h3 { margin:0 0 12px; font-size:14px; }
.partner-contact-form .form-field { margin-bottom:11px; }
.partner-contact-form .checkbox-field { min-height:30px; font-size:13px; }
.partner-contact-form .button-link { margin-top:8px; width:100%; }
@media (max-width:1000px){ .partner-detail-layout{grid-template-columns:1fr;} }
@media (max-width:760px){ .partner-filters{grid-template-columns:1fr;} }


/* AUTOMATIONS */

.automation-email-status {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 20px 0;
    padding: 14px 16px;
    border-radius: 9px;
    border: 1px solid #dbe3ec;
    background: #fff;
}

.automation-email-status.configured {
    background: #eef9f3;
    border-color: #ccebd9;
}

.automation-email-status.test-mode {
    background: #fff8e8;
    border-color: #f2dfae;
}

.automation-email-status strong,
.automation-email-status span,
.automation-email-status small {
    display: block;
}

.automation-email-status span {
    margin-top: 4px;
    color: #5f6b7c;
    font-size: 13px;
}

.automation-email-status small {
    color: #7a8494;
    white-space: nowrap;
}

.automation-panel {
    overflow: hidden;
}

.automation-table {
    display: grid;
    grid-template-columns: 1.45fr 1fr .65fr .65fr .75fr 1fr;
    gap: 14px;
    align-items: center;
    padding: 13px 18px;
}

.automation-table-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e7ee;
    color: #687386;
    font-size: 12px;
    font-weight: 600;
}

.automation-table-row {
    border-bottom: 1px solid #edf0f4;
    font-size: 13px;
}

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

.automation-table strong,
.automation-table small {
    display: block;
}

.automation-table small {
    margin-top: 4px;
    color: #7b8595;
}

.automation-actions-cell {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: wrap;
}

.automation-actions-cell form {
    margin: 0;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d3dae4;
    border-radius: 7px;
    background: #fff;
    color: #344054;
    padding: 7px 9px;
    font: inherit;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}

.automation-success {
    color: #17724a !important;
}

.automation-warning {
    color: #9a6700 !important;
}

.automation-error {
    color: #b42318 !important;
}

.automation-form-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 20px;
    align-items: start;
    margin-top: 22px;
}

.automation-form {
    overflow: hidden;
}

.automation-subheading {
    margin: 16px 0 9px;
    font-size: 13px;
}

.automation-check-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.automation-check-grid label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px;
    border: 1px solid #e0e5eb;
    border-radius: 7px;
    background: #fafbfc;
    font-size: 13px;
}

.field-help {
    display: block;
    margin-top: 6px;
    color: #7a8494;
    font-size: 12px;
}

.automation-help-card {
    position: sticky;
    top: 78px;
}

.automation-help-card code {
    display: block;
    margin: 5px 0;
    padding: 5px 7px;
    border-radius: 5px;
    background: #f5f7fa;
    color: #344054;
    font-size: 12px;
}

@media (max-width: 1150px) {
    .automation-table {
        grid-template-columns: 1.4fr 1fr .7fr .8fr;
    }

    .automation-table > :nth-child(5),
    .automation-table-header > :nth-child(5) {
        display: none;
    }

    .automation-form-layout {
        grid-template-columns: 1fr;
    }

    .automation-help-card {
        position: static;
    }
}

@media (max-width: 760px) {
    .automation-email-status {
        flex-direction: column;
    }

    .automation-table {
        grid-template-columns: 1fr;
    }

    .automation-table-header {
        display: none;
    }

    .automation-actions-cell {
        justify-content: flex-start;
    }

    .automation-check-grid {
        grid-template-columns: 1fr;
    }
}
