:root {
    --portal-primary: var(--gd-primary, #0F52BA);
    --portal-primary-dark: var(--gd-primary-dark, #0D4499);
    --portal-primary-light: #DBEAFE;
    --portal-bg: var(--gd-bg, #F8FAFC);
    --portal-surface: #ffffff;
    --portal-text: var(--gd-text, #1E293B);
    --portal-muted: var(--gd-muted, #64748B);
    --portal-border: #BFDBFE;
    --portal-shadow: 0 4px 24px rgba(15, 82, 186, 0.12);
    --portal-radius: 16px;
    --portal-nav-height: 72px;
}

.portal-shell {
    background: var(--portal-bg);
    min-height: 100vh;
    padding-bottom: calc(var(--portal-nav-height) + 1rem);
    font-family: var(--gd-font, "Vazirmatn", Tahoma, "Segoe UI", sans-serif);
    color: var(--portal-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.portal-header {
    background: linear-gradient(135deg, var(--portal-primary) 0%, var(--portal-primary-dark) 100%);
    color: #fff;
    padding: 1rem 0 1.5rem;
    box-shadow: var(--portal-shadow);
}

.portal-header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.portal-header__brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    text-decoration: none;
}

.portal-header__brand:hover {
    color: #fff;
    opacity: 0.9;
}

.portal-header__user {
    font-size: 0.875rem;
    opacity: 0.9;
}

.portal-content {
    padding-top: 1.25rem;
    padding-bottom: 2rem;
    max-width: 960px;
    margin: 0 auto;
}

.portal-page-header {
    margin-bottom: 1.25rem;
}

.portal-page-header h1,
.portal-page-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--portal-primary-dark);
    margin: 0;
}

.portal-hero {
    background: linear-gradient(135deg, var(--portal-primary-light) 0%, #fff 100%);
    border-radius: var(--portal-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--portal-border);
}

.portal-hero h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--portal-primary-dark);
}

.portal-hero p {
    margin: 0;
    color: var(--portal-muted);
    font-size: 0.95rem;
}

.portal-banner {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: var(--portal-radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    color: #92400e;
}

.portal-banner--info {
    background: var(--portal-primary-light);
    border-color: var(--portal-border);
    color: var(--portal-primary-dark);
}

.portal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.portal-stat {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}

.portal-stat__value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--portal-primary);
    line-height: 1.2;
}

.portal-stat__label {
    font-size: 0.85rem;
    color: var(--portal-muted);
    margin-top: 0.25rem;
}

.portal-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.portal-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    text-decoration: none;
    color: var(--portal-text);
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 100px;
}

.portal-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--portal-shadow);
    color: var(--portal-primary-dark);
    border-color: var(--portal-primary);
}

.portal-action i {
    font-size: 1.75rem;
    color: var(--portal-primary);
}

.portal-action span {
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
}

.portal-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--portal-surface);
    border-top: 1px solid var(--portal-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--portal-nav-height);
    padding: 0;
    z-index: 1000;
    box-shadow: 0 -4px 24px rgba(15, 82, 186, 0.08);
}

.portal-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 12px;
    transition: color 0.15s, background 0.15s;
    min-width: 0;
    flex: 1;
    justify-content: center;
}

.portal-nav__item:hover,
.portal-nav__item.active {
    color: var(--portal-primary);
    background: var(--portal-primary-light);
}

.portal-nav__item i {
    font-size: 1.35rem;
}

.portal-card {
    background: var(--portal-surface);
    border-radius: var(--portal-radius);
    border: 1px solid var(--portal-border);
    box-shadow: var(--portal-shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}

.portal-card__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
    font-weight: 600;
    color: var(--portal-primary-dark);
}

.portal-card__body {
    padding: 1.25rem;
}

.portal-quote-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
}

.portal-quote-item:last-child {
    border-bottom: none;
}

.portal-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.portal-badge--sent { background: #dbeafe; color: #1d4ed8; }
.portal-badge--accepted { background: #d1fae5; color: #047857; }
.portal-badge--approved { background: #e0e7ff; color: #4338ca; }

.portal-progress__track {
    display: flex;
    justify-content: space-between;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.portal-progress__step {
    flex: 1;
    min-width: 60px;
    text-align: center;
    position: relative;
}

.portal-progress__marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--portal-muted);
    margin-bottom: 0.35rem;
}

.portal-progress__step--completed .portal-progress__marker {
    background: var(--portal-primary);
    color: #fff;
}

.portal-progress__step--current .portal-progress__marker {
    background: var(--portal-primary-dark);
    color: #fff;
    box-shadow: 0 0 0 4px var(--portal-primary-light);
}

.portal-progress__label {
    display: block;
    font-size: 0.65rem;
    color: var(--portal-muted);
    line-height: 1.2;
}

.portal-progress__step--current .portal-progress__label {
    color: var(--portal-primary-dark);
    font-weight: 600;
}

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

.portal-table,
.table.portal-table {
    margin-bottom: 0;
    width: 100%;
}

.portal-table thead th,
.table.portal-table thead th {
    background: var(--portal-primary-light);
    color: var(--portal-primary-dark);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--portal-border);
    white-space: nowrap;
}

.portal-table tbody td,
.table.portal-table tbody td {
    vertical-align: middle;
    border-bottom: 1px solid var(--portal-border);
}

.portal-table tbody tr:hover,
.table.portal-table tbody tr:hover {
    background: rgba(219, 234, 254, 0.35);
}

.portal-table tbody tr:last-child td {
    border-bottom: none;
}

.portal-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    border: 1px solid var(--portal-border);
    border-radius: var(--portal-radius);
    overflow: hidden;
    background: var(--portal-surface);
    box-shadow: var(--portal-shadow);
}

.portal-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--portal-border);
}

.portal-list__item:last-child {
    border-bottom: none;
}

.portal-list__item--unread {
    background: rgba(219, 234, 254, 0.4);
    font-weight: 600;
}

.portal-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--portal-muted);
}

.portal-form .form-control,
.portal-form .form-select {
    border-radius: 12px;
    border-color: var(--portal-border);
}

.portal-form .form-control:focus,
.portal-form .form-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px var(--portal-primary-light);
}

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

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

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

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

.portal-shell .form-control:focus,
.portal-shell .form-select:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px var(--portal-primary-light);
}

.portal-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--portal-bg) 0%, #E2E8F0 50%, #fff 100%);
    padding: 2rem 1rem;
    font-family: var(--gd-font, "Vazirmatn", Tahoma, "Segoe UI", sans-serif);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.portal-auth__card {
    width: 100%;
    max-width: 420px;
    background: var(--portal-surface);
    border-radius: calc(var(--portal-radius) + 4px);
    box-shadow: var(--portal-shadow);
    padding: 2rem;
    border: 1px solid var(--portal-border);
}

.portal-auth__logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.portal-auth__title {
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    color: var(--portal-primary-dark);
    margin-bottom: 0.35rem;
}

.portal-auth__subtitle {
    text-align: center;
    color: var(--portal-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.portal-auth .form-control {
    border-radius: 12px;
    border-color: var(--portal-border);
    padding: 0.75rem 1rem;
}

.portal-auth .form-control:focus {
    border-color: var(--portal-primary);
    box-shadow: 0 0 0 3px var(--portal-primary-light);
}

.portal-auth .btn-primary {
    background: var(--portal-primary);
    border-color: var(--portal-primary);
    border-radius: 12px;
    padding: 0.75rem;
    font-weight: 600;
    width: 100%;
}

.portal-auth .btn-primary:hover {
    background: var(--portal-primary-dark);
    border-color: var(--portal-primary-dark);
}

.portal-auth__footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.9rem;
    color: var(--portal-muted);
}

.portal-auth__footer a {
    color: var(--portal-primary);
    font-weight: 600;
    text-decoration: none;
}

@media (min-width: 768px) {
    .portal-nav {
        position: static;
        border-top: none;
        border-bottom: 1px solid var(--portal-border);
        height: auto;
        padding: 0.75rem 0;
        margin-bottom: 1rem;
        box-shadow: none;
        justify-content: center;
        gap: 0.5rem;
    }

    .portal-shell {
        padding-bottom: 0;
    }

    .portal-nav__item {
        flex: 0 0 auto;
        flex-direction: row;
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .portal-nav__item i {
        font-size: 1.1rem;
    }
}
