:root {
    --portal-blue: #0d6fcb;
    --portal-blue-deep: #0b4e90;
    --portal-orange: #ff9d1e;
    --portal-orange-deep: #f28705;
    --portal-ink: #1f2f43;
    --portal-muted: #6e7f92;
    --portal-surface: #ffffff;
    --portal-background: linear-gradient(180deg, #f4f8fc 0%, #eef3f8 42%, #f5f7fb 100%);
    --portal-border: #dbe5ef;
    --portal-success: #2b9d55;
    --portal-danger: #d94d4d;
    --portal-shadow: 0 20px 44px rgba(12, 42, 76, 0.08);
    --portal-radius: 24px;
    --portal-font: "Segoe UI", "Trebuchet MS", Arial, sans-serif;
}

body[data-theme="dark"] {
    --portal-ink: #eef4ff;
    --portal-muted: #9caec6;
    --portal-surface: #152232;
    --portal-background: linear-gradient(180deg, #09131f 0%, #0d1827 42%, #0b1420 100%);
    --portal-border: #26384d;
    --portal-shadow: 0 22px 46px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--portal-font);
    background: var(--portal-background);
    color: var(--portal-ink);
}

a {
    color: inherit;
}

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

.portal-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.portal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 32px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(219, 229, 239, 0.9);
    position: sticky;
    top: 0;
    z-index: 20;
}

body[data-theme="dark"] .portal-topbar,
body[data-theme="dark"] .portal-main-header,
body[data-theme="dark"] .portal-nav,
body[data-theme="dark"] .portal-card,
body[data-theme="dark"] .portal-user-badge,
body[data-theme="dark"] .portal-list-item,
body[data-theme="dark"] .portal-modal-card {
    background: rgba(21, 34, 50, 0.94);
    border-color: rgba(38, 56, 77, 0.96);
}

.portal-logo {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
}

.portal-logo img {
    width: 156px;
    max-width: 42vw;
    border-radius: 14px;
    box-shadow: 0 12px 24px rgba(13, 111, 203, 0.18);
}

.portal-logo-copy strong {
    display: block;
    font-size: 1.05rem;
}

.portal-logo-copy span {
    color: var(--portal-muted);
    font-size: 0.92rem;
}

.portal-topbar-actions,
.portal-user-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portal-user-badge {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 999px;
    box-shadow: 0 10px 20px rgba(11, 78, 144, 0.06);
}

.portal-user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--portal-orange) 0%, #ffd27a 100%);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.portal-button,
.portal-link-button {
    border: 0;
    border-radius: 14px;
    padding: 13px 18px;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.portal-button:hover,
.portal-link-button:hover {
    transform: translateY(-1px);
}

.portal-button-primary {
    background: linear-gradient(135deg, var(--portal-blue) 0%, var(--portal-blue-deep) 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(13, 111, 203, 0.22);
}

.portal-button-secondary {
    background: linear-gradient(135deg, var(--portal-blue) 0%, var(--portal-blue-deep) 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(13, 111, 203, 0.22);
}

.portal-button-ghost,
.portal-link-button {
    background: #fff;
    color: var(--portal-blue-deep);
    border: 1px solid var(--portal-border);
}

body[data-theme="dark"] .portal-button-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--portal-ink);
}

.portal-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--portal-blue-deep);
    text-decoration: underline;
}

.portal-auth {
    display: grid;
    grid-template-columns: minmax(320px, 620px) minmax(280px, 420px);
    gap: 36px;
    padding: 56px 32px 40px;
    flex: 1;
    width: min(1180px, 100%);
    margin: 0 auto;
}

.portal-auth-single {
    grid-template-columns: minmax(320px, 760px);
    justify-content: center;
}

.portal-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(219, 229, 239, 0.95);
    border-radius: var(--portal-radius);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
}

.portal-card-head {
    padding: 28px 30px 18px;
    border-bottom: 1px solid rgba(219, 229, 239, 0.82);
}

.portal-card-head h1,
.portal-card-head h2,
.portal-card-head h3 {
    margin: 0 0 8px;
}

.portal-kicker {
    color: var(--portal-orange-deep);
    font-size: 0.84rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.portal-auth .portal-card-head .portal-kicker {
    color: var(--portal-blue-deep);
}

.portal-card-body {
    padding: 28px 30px 30px;
}

.portal-card-body p {
    margin: 0 0 14px;
    color: var(--portal-muted);
    line-height: 1.6;
}

.portal-status-card {
    overflow: hidden;
}

.portal-status-body {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 18px;
}

.portal-status-icon {
    width: 112px;
    height: 112px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 3.4rem;
    font-weight: 800;
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
}

.portal-status-icon.success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
}

.portal-status-icon.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
}

.portal-status-lead {
    max-width: 580px;
    font-size: 1.05rem;
}

.portal-status-actions {
    justify-content: center;
    width: 100%;
}

.portal-form {
    display: grid;
    gap: 18px;
}

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

.portal-field {
    display: grid;
    gap: 8px;
}

.portal-field label {
    font-weight: 600;
    color: var(--portal-ink);
}

.portal-input,
.portal-select,
.portal-textarea {
    width: 100%;
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--portal-ink);
    box-shadow: inset 0 1px 2px rgba(10, 31, 58, 0.03);
}

.portal-textarea {
    min-height: 120px;
    resize: vertical;
}

.portal-input:focus,
.portal-select:focus,
.portal-textarea:focus {
    outline: 2px solid rgba(13, 111, 203, 0.16);
    border-color: rgba(13, 111, 203, 0.55);
}

.portal-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.portal-helper-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.portal-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.84rem;
    font-weight: 700;
}

.portal-pill-success {
    background: rgba(43, 157, 85, 0.14);
    color: var(--portal-success);
}

.portal-pill-warning {
    background: rgba(255, 157, 30, 0.14);
    color: var(--portal-orange-deep);
}

.portal-pill-danger {
    background: rgba(217, 77, 77, 0.14);
    color: var(--portal-danger);
}

.portal-note {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(13, 111, 203, 0.18);
    background: rgba(13, 111, 203, 0.1);
    color: var(--portal-blue-deep);
}

.portal-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 28px;
    width: min(1320px, calc(100% - 40px));
    margin: 28px auto 36px;
    flex: 1;
}

.portal-sidebar {
    display: grid;
    gap: 20px;
    align-content: start;
}

.portal-nav {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(219, 229, 239, 0.95);
    border-radius: 28px;
    box-shadow: var(--portal-shadow);
    overflow: hidden;
}

.portal-nav button {
    width: 100%;
    padding: 20px 24px;
    border: 0;
    text-align: left;
    background: transparent;
    font-size: 1rem;
    font-weight: 700;
    color: var(--portal-ink);
    border-bottom: 1px solid rgba(219, 229, 239, 0.85);
    cursor: pointer;
}

.portal-nav button:last-child {
    border-bottom: 0;
}

.portal-nav button.active {
    color: var(--portal-orange-deep);
    background: linear-gradient(90deg, rgba(255, 157, 30, 0.12) 0%, rgba(255, 255, 255, 0.92) 100%);
}

.portal-main {
    display: grid;
    gap: 24px;
    align-content: start;
}

.portal-main-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(219, 229, 239, 0.85);
    border-radius: 24px;
    box-shadow: var(--portal-shadow);
}

.portal-main-header h1 {
    margin: 0;
    font-size: clamp(2rem, 2.8vw, 3rem);
    line-height: 1.05;
}

.portal-main-header p {
    margin: 8px 0 0;
    color: var(--portal-muted);
}

.portal-panels {
    display: grid;
    gap: 24px;
}

.portal-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.portal-metric {
    background: var(--portal-surface);
    border: 1px solid rgba(219, 229, 239, 0.95);
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--portal-shadow);
}

.portal-metric span {
    display: block;
    font-size: 0.86rem;
    color: var(--portal-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
}

.portal-metric strong {
    font-size: clamp(1.7rem, 2vw, 2.4rem);
}

.portal-card-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

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

.portal-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.portal-table th,
.portal-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(219, 229, 239, 0.92);
    text-align: left;
    vertical-align: top;
}

.portal-table th {
    color: var(--portal-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.portal-empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--portal-muted);
}

.portal-service-list,
.portal-ticket-list,
.portal-document-list,
.portal-notification-list {
    display: grid;
    gap: 16px;
}

.portal-list-item {
    border: 1px solid rgba(219, 229, 239, 0.92);
    border-radius: 20px;
    padding: 18px 20px;
    background: #fff;
}

.portal-list-item h3,
.portal-list-item h4 {
    margin: 0 0 8px;
}

.portal-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    color: var(--portal-muted);
    font-size: 0.92rem;
}

.portal-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

.portal-detail {
    background: rgba(13, 111, 203, 0.04);
    border-radius: 16px;
    padding: 14px 16px;
}

.portal-detail span {
    display: block;
    color: var(--portal-muted);
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.portal-detail strong {
    font-size: 1rem;
}

.portal-tabs {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
}

.portal-tab {
    border: 1px solid var(--portal-border);
    background: var(--portal-surface);
    border-radius: 999px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.portal-tab.active {
    background: linear-gradient(135deg, rgba(255, 157, 30, 0.12) 0%, rgba(255, 255, 255, 1) 100%);
    color: var(--portal-orange-deep);
    border-color: rgba(255, 157, 30, 0.4);
}

.portal-footer {
    margin-top: auto;
    background: linear-gradient(135deg, var(--portal-blue) 0%, var(--portal-blue-deep) 100%);
    color: #fff;
    padding: 20px 32px;
}

.portal-footer-inner {
    width: min(1320px, 100%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.portal-message {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 18px;
    font-weight: 600;
}

.portal-message.error {
    background: rgba(217, 77, 77, 0.12);
    color: var(--portal-danger);
}

.portal-message.success {
    background: rgba(43, 157, 85, 0.12);
    color: var(--portal-success);
}

.portal-modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 24, 38, 0.42);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 30;
}

.portal-modal-card {
    width: min(640px, 100%);
    background: #fff;
    border-radius: 28px;
    border: 1px solid rgba(219, 229, 239, 0.95);
    box-shadow: 0 30px 80px rgba(10, 28, 50, 0.24);
    overflow: hidden;
}

.portal-loading {
    min-height: 100vh;
    display: grid;
    place-items: center;
    color: var(--portal-blue-deep);
    font-size: 1.05rem;
}

body[data-theme="dark"] .portal-table th,
body[data-theme="dark"] .portal-table td,
body[data-theme="dark"] .portal-nav button,
body[data-theme="dark"] .portal-card-head,
body[data-theme="dark"] .portal-list-item,
body[data-theme="dark"] .portal-user-badge {
    border-color: rgba(38, 56, 77, 0.92);
}

body[data-theme="dark"] .portal-nav button.active {
    background: linear-gradient(90deg, rgba(13, 111, 203, 0.18) 0%, rgba(21, 34, 50, 0.94) 100%);
    color: #86c3ff;
}

body[data-theme="dark"] .portal-detail,
body[data-theme="dark"] .portal-note,
body[data-theme="dark"] .portal-pill-success,
body[data-theme="dark"] .portal-pill-warning,
body[data-theme="dark"] .portal-pill-danger {
    background-clip: padding-box;
}

@media (max-width: 1120px) {
    .portal-auth,
    .portal-layout,
    .portal-card-grid,
    .portal-split {
        grid-template-columns: 1fr;
    }

    .portal-metrics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .portal-topbar,
    .portal-auth,
    .portal-layout {
        padding-left: 18px;
        padding-right: 18px;
        width: 100%;
    }

    .portal-topbar {
        flex-wrap: wrap;
    }

    .portal-grid-two,
    .portal-detail-grid {
        grid-template-columns: 1fr;
    }

    .portal-main-header {
        padding: 18px;
    }

    .portal-card-body,
    .portal-card-head {
        padding-left: 20px;
        padding-right: 20px;
    }
}
