/* ============================================================
   BSE Express — Client Portal Design System
   Inherits from main site | Accent matches main design system
   Font: Inter | Zero shadows | border-radius: 8px buttons, 12-16px cards
   ============================================================ */

/* --- Portal Theme Variables --- */
:root,
[data-theme="light"] {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F8FA;
    --bg-card: #FFFFFF;
    --text-primary: #0F1D32;
    --text-secondary: #374151;
    --text-tertiary: #6B7280;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --accent: #0F1D32;
    --accent-hover: #1a2d47;
    --accent-10: rgba(15, 29, 50, 0.06);
    --accent-text: #FFFFFF;
    --logo-filter: none;

    --bg-sidebar: #F7F8FA;
    --bg-status-success: rgba(34, 197, 94, 0.1);
    --bg-status-warning: rgba(245, 158, 11, 0.1);
    --bg-status-error: rgba(239, 68, 68, 0.1);
    --bg-status-info: rgba(59, 130, 246, 0.1);
    --text-status-success: #16A34A;
    --text-status-warning: #D97706;
    --text-status-error: #DC2626;
    --text-status-info: #2563EB;
}

[data-theme="dark"] {
    --bg-primary: #0F1D32;
    --bg-secondary: #0A1628;
    --bg-card: #162540;
    --text-primary: #FFFFFF;
    --text-secondary: #D1D5DB;
    --text-tertiary: #9CA3AF;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --accent: #FFFFFF;
    --accent-hover: rgba(255, 255, 255, 0.85);
    --accent-10: rgba(255, 255, 255, 0.08);
    --accent-text: #0F1D32;
    --logo-filter: brightness(0) invert(1);

    --bg-sidebar: #0A1628;
    --bg-status-success: rgba(34, 197, 94, 0.15);
    --bg-status-warning: rgba(245, 158, 11, 0.15);
    --bg-status-error: rgba(239, 68, 68, 0.15);
    --bg-status-info: rgba(59, 130, 246, 0.15);
    --text-status-success: #4ADE80;
    --text-status-warning: #FBBF24;
    --text-status-error: #F87171;
    --text-status-info: #60A5FA;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

ul,
ol {
    list-style: none;
}

img {
    display: block;
    max-width: 100%;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

/* --- Typography --- */
h1 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
}

h2 {
    font-size: 22px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
}

h3 {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
}

h4 {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--text-primary);
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 12px;
}

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

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

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--accent-text);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* --- Portal Layout --- */
.portal {
    display: flex;
    min-height: 100vh;
    padding-top: 64px;
}

/* --- Portal Header --- */
.portal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    transition: background-color 0.3s, border-color 0.3s;
}

.portal-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

.portal-header__left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.portal-header__logo {
    height: 32px;
    width: auto;
    filter: var(--logo-filter);
    transition: filter 0.3s;
}

.portal-header__mode-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--border);
}

.portal-header__mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.portal-header__mode-btn.is-active {
    background-color: var(--accent);
    color: var(--accent-text);
}

.portal-header__mode-btn svg {
    width: 16px;
    height: 16px;
}

.portal-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portal-header__notif {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.portal-header__notif:hover {
    color: var(--text-primary);
}

.portal-header__notif svg {
    width: 20px;
    height: 20px;
}

.portal-header__badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-status-error);
    border: 2px solid var(--bg-primary);
}

.portal-header__theme {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.portal-header__theme:hover {
    color: var(--text-primary);
}

.portal-header__theme svg {
    width: 18px;
    height: 18px;
}

[data-theme="light"] .theme-icon--sun {
    display: none;
}

[data-theme="light"] .theme-icon--moon {
    display: block;
}

[data-theme="dark"] .theme-icon--sun {
    display: block;
}

[data-theme="dark"] .theme-icon--moon {
    display: none;
}

.portal-header__avatar {
    position: relative;
}

.portal-header__avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--accent);
    color: var(--accent-text);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portal-header__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    z-index: 200;
}

.portal-header__dropdown.is-open {
    display: block;
}

.portal-header__dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background-color 0.15s;
    width: 100%;
    text-align: left;
}

.portal-header__dropdown-item:hover {
    background-color: var(--bg-secondary);
}

.portal-header__dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.portal-header__dropdown-divider {
    height: 1px;
    background: var(--border);
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    overflow-y: auto;
    transition: background-color 0.3s, border-color 0.3s, width 0.3s;
    z-index: 50;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    transition: all 0.15s;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar__link:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.sidebar__link.is-active {
    background-color: var(--accent-10);
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

.sidebar__link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar__link-text {
    white-space: nowrap;
    overflow: hidden;
}

.sidebar__divider {
    height: 1px;
    background: var(--border);
    margin: 12px 16px;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    min-height: calc(100vh - 64px);
    transition: margin-left 0.3s;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    margin-bottom: 4px;
}

.page-header p {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s, background-color 0.3s;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-grid {
    display: grid;
    gap: 16px;
}

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

.card-grid--3 {
    grid-template-columns: repeat(3, 1fr);
}

.card-grid--4 {
    grid-template-columns: repeat(4, 1fr);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card__icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-10);
    color: var(--accent);
}

.card__icon-wrap svg {
    width: 20px;
    height: 20px;
}

/* --- Status Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.badge--success {
    background: var(--bg-status-success);
    color: var(--text-status-success);
}

.badge--warning {
    background: var(--bg-status-warning);
    color: var(--text-status-warning);
}

.badge--error {
    background: var(--bg-status-error);
    color: var(--text-status-error);
}

.badge--info {
    background: var(--bg-status-info);
    color: var(--text-status-info);
}

.badge--accent {
    background: var(--accent-10);
    color: var(--accent);
}

.badge__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* --- Alert Cards --- */
.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid;
}

.alert-card--warning {
    background: var(--bg-status-warning);
    border-color: var(--text-status-warning);
}

.alert-card--info {
    background: var(--bg-status-info);
    border-color: var(--text-status-info);
}

.alert-card--success {
    background: var(--bg-status-success);
    border-color: var(--text-status-success);
}

.alert-card__icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.alert-card__text {
    font-size: 14px;
    line-height: 1.5;
}

.alert-card__text strong {
    font-weight: 500;
}

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

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: var(--bg-secondary);
}

.data-table tr {
    cursor: pointer;
    transition: background-color 0.15s;
}

.data-table__method {
    display: flex;
    align-items: center;
    gap: 6px;
}

.data-table__method svg {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.data-table__actions .btn {
    font-size: 13px;
}

/* --- Filters --- */
.filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.filter-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.filter-btn.is-active {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.filter-search {
    position: relative;
    flex: 1;
    max-width: 280px;
}

.filter-search__input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 13px;
    transition: border-color 0.2s;
}

.filter-search__input::placeholder {
    color: var(--text-tertiary);
}

.filter-search__input:focus {
    outline: none;
    border-color: var(--accent);
}

.filter-search__icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

/* --- Timeline --- */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline__item {
    position: relative;
    padding-bottom: 32px;
}

.timeline__item:last-child {
    padding-bottom: 0;
}

.timeline__dot {
    position: absolute;
    left: -32px;
    top: 2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline__dot--completed {
    background: var(--accent);
}

.timeline__dot--completed svg {
    width: 12px;
    height: 12px;
    color: var(--accent-text);
}

.timeline__dot--current {
    background: var(--accent);
    animation: pulse-dot 2s infinite;
}

.timeline__dot--current svg {
    width: 12px;
    height: 12px;
    color: var(--accent-text);
}

@keyframes pulse-dot {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 122, 35, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(255, 122, 35, 0);
    }
}

.timeline__dot--future {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
}

.timeline__title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeline__item--future .timeline__title {
    color: var(--text-tertiary);
}

.timeline__date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}

.timeline__comment {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 8px;
}

.timeline__photos {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.timeline__photo {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
}

.timeline__photo:hover {
    border-color: var(--accent);
}

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

/* --- Chat --- */
.chat-layout {
    display: flex;
    height: calc(100vh - 64px - 64px);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-messages__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.chat-messages__header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-messages__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-bubble--user {
    align-self: flex-end;
    background: var(--accent-10);
    color: var(--text-primary);
}

.chat-bubble--manager {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.chat-bubble__time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.chat-chips {
    display: flex;
    gap: 8px;
    padding: 8px 20px;
    overflow-x: auto;
}

.chat-chip {
    display: inline-flex;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.15s;
}

.chat-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.chat-input__field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s;
}

.chat-input__field::placeholder {
    color: var(--text-tertiary);
}

.chat-input__field:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-input__attach {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.chat-input__attach:hover {
    color: var(--text-primary);
}

.chat-input__attach svg {
    width: 20px;
    height: 20px;
}

.chat-input__send {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: 8px;
    transition: background-color 0.2s;
}

.chat-input__send:hover {
    background: var(--accent-hover);
}

.chat-input__send svg {
    width: 18px;
    height: 18px;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, background-color 0.3s;
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input--error {
    border-color: var(--text-status-error);
}

.form-input--success {
    border-color: var(--text-status-success);
}

.form-error {
    font-size: 12px;
    color: var(--text-status-error);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* --- Toggle --- */
.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle__slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 12px;
    transition: background-color 0.2s;
}

.toggle__slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--bg-primary);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle input:checked+.toggle__slider {
    background: var(--accent);
}

.toggle input:checked+.toggle__slider::before {
    transform: translateX(20px);
}

/* --- Warehouse Address Card --- */
.warehouse-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    background: var(--bg-card);
    text-align: center;
    transition: border-color 0.3s, background-color 0.3s;
}

.warehouse-card__label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.warehouse-card__address {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.warehouse-card__address-cn {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.warehouse-card__id {
    color: var(--accent);
    font-weight: 600;
}

.warehouse-card__actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

/* --- Quick Actions --- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-align: center;
    transition: border-color 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.quick-action:hover {
    border-color: var(--accent);
}

.quick-action__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-10);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action__icon svg {
    width: 20px;
    height: 20px;
}

.quick-action__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-tertiary);
}

.empty-state__title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state__text {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
}

.lightbox.is-open {
    display: flex;
}

.lightbox__img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
}

.lightbox__close {
    position: absolute;
    top: 20px;
    right: 24px;
    color: #FFFFFF;
    font-size: 24px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.lightbox__close:hover {
    opacity: 1;
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #FFFFFF;
    font-size: 32px;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 16px;
}

.lightbox__nav:hover {
    opacity: 1;
}

.lightbox__nav--prev {
    left: 16px;
}

.lightbox__nav--next {
    right: 16px;
}

/* --- Onboarding Wizard --- */
.onboarding-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.onboarding-overlay.is-open {
    display: flex;
}

.onboarding {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    max-width: 520px;
    width: 90%;
    text-align: center;
}

.onboarding__step-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
}

.onboarding__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.onboarding__dot.is-active {
    background: var(--accent);
}

.onboarding__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    color: var(--accent);
}

.onboarding__title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.onboarding__text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.onboarding__address {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    padding: 12px 20px;
    background: var(--accent-10);
    border-radius: 8px;
    margin-bottom: 20px;
    display: inline-block;
}

.onboarding__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.onboarding__skip {
    font-size: 13px;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.onboarding__skip:hover {
    color: var(--text-primary);
}

/* --- Auth Pages --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
}

.auth-card__logo {
    height: 36px;
    margin: 0 auto 32px;
    filter: var(--logo-filter);
}

.auth-card__title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-card__subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
}

.auth-card .form-group {
    text-align: left;
}

.auth-card__footer {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-tertiary);
}

.auth-card__footer a {
    color: var(--accent);
    font-weight: 500;
}

.auth-card__divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

.auth-card__divider::before,
.auth-card__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-card__telegram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.auth-card__telegram:hover {
    border-color: var(--border-hover);
}

.auth-card__telegram svg {
    width: 20px;
    height: 20px;
}

/* --- Profile --- */
.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 28px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.settings-group {
    margin-bottom: 32px;
}

.settings-group__title {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

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

.settings-item__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-item__left svg {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

.settings-item__label {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-primary);
}

.settings-item__desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* --- Document List --- */
.doc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.2s;
}

.doc-item:hover {
    border-color: var(--border-hover);
}

.doc-item__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-status-error);
    color: var(--text-status-error);
    display: flex;
    align-items: center;
    justify-content: center;
}

.doc-item__icon svg {
    width: 18px;
    height: 18px;
}

.doc-item__info {
    flex: 1;
}

.doc-item__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.doc-item__meta {
    font-size: 12px;
    color: var(--text-tertiary);
}

.doc-item__download {
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.doc-item__download:hover {
    color: var(--accent);
}

.doc-item__download svg {
    width: 18px;
    height: 18px;
}

/* --- Section spacing --- */
.section-block {
    margin-bottom: 32px;
}

.section-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-block__title {
    font-size: 16px;
    font-weight: 500;
}

.section-block__link {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    transition: opacity 0.2s;
}

.section-block__link:hover {
    opacity: 0.8;
}

/* --- Hamburger (for portal mobile) --- */
.portal-hamburger {
    display: none;
    width: 24px;
    height: 24px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.portal-hamburger span {
    display: block;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
}

/* --- Bottom Tab Bar (mobile) --- */
.bottom-tabs {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-tabs__inner {
    display: flex;
    height: 100%;
}

.bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 500;
    position: relative;
    text-decoration: none;
    transition: color 0.15s;
}

.bottom-tab.is-active {
    color: var(--accent);
}

.bottom-tab.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
}

.bottom-tab svg {
    width: 22px;
    height: 22px;
}

.bottom-tab__badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 16px);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-status-error);
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .sidebar {
        width: 56px;
    }

    .sidebar__link {
        justify-content: center;
        padding: 10px;
        border-left: none;
    }

    .sidebar__link-text {
        display: none;
    }

    .main-content {
        margin-left: 56px;
    }

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

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

    .portal-header__mode-btn span {
        display: none;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px 80px;
    }

    .bottom-tabs {
        display: block;
    }

    .portal {
        padding-bottom: 56px;
    }

    .portal-header__mode-switch {
        display: none;
    }

    .portal-hamburger {
        display: flex;
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 18px;
    }

    .card-grid--2,
    .card-grid--3,
    .card-grid--4 {
        grid-template-columns: 1fr;
    }

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

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

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-search {
        max-width: none;
    }

    /* Table → Card on mobile */
    .data-table thead {
        display: none;
    }

    .data-table tr {
        display: block;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 12px;
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        border-bottom: none;
        font-size: 13px;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--text-tertiary);
        font-size: 12px;
    }

    .chat-layout {
        height: calc(100vh - 64px - 56px);
        border: none;
        border-radius: 0;
    }

    .auth-card {
        padding: 24px;
    }

    .warehouse-card {
        padding: 24px;
    }

    .warehouse-card__address {
        font-size: 16px;
    }
}