:root {
    --bg-primary: #0f172a;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --accent: #e91e8c;
    --accent-orange: #ff6b35;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Client Header */
.client-header {
    background: #000;
    color: #fff;
    padding: 16px 16px 16px;
}
.client-header .logo-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.client-header .logo-text {
    font-weight: 800;
    font-size: 16px;
}
.client-header .logo-sep {
    color: rgba(255,255,255,0.4);
    font-size: 15px;
    margin: 0 4px;
}
.client-header .logo-sub {
    color: rgba(255,255,255,0.8);
    font-size: 14px;
}
.client-header .user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.client-header .avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.client-header .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.client-header .vip-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #e91e8c, #ff6b35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 800;
    color: #fff;
}
.client-header .user-info { margin-left: 12px; flex: 1; }
.client-header .store-name { font-weight: 800; font-size: 15px; }
.client-header .stars { display: flex; gap: 2px; margin-top: 2px; }
.client-header .stars span { font-size: 13px; }
.client-header .star-filled { color: #facc15; }
.client-header .star-empty { color: #64748b; }
.client-header .msg-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
    position: relative;
}
.client-header .msg-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ff2f65;
    color: #fff;
    font-size: 10px;
    line-height: 17px;
    text-align: center;
    font-weight: 700;
    border: 1px solid #000;
}

/* Cards */
.page-title-bar {
    background: #0f172a;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.page-title-bar a {
    color: #fff;
    font-size: 20px;
}
.page-title-bar h2 {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    margin: 0;
}
.tk-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin: 12px;
    overflow: hidden;
}
.tk-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border-light);
}
.tk-card-header h3 {
    font-weight: 800;
    font-size: 13px;
    color: var(--text-primary);
}

/* Financial Overview */
.fin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.fin-grid .fin-item {
    padding: 16px;
    text-align: center;
}
.fin-grid .fin-item + .fin-item {
    border-left: 1px solid var(--border-light);
}
.fin-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}
.fin-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Today stats pills */
.today-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 0 12px 12px;
}
.today-pill {
    background: #000;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}
.today-pill .label {
    font-size: 10px;
    color: rgba(255,255,255,0.6);
}
.today-pill .value {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    margin-top: 2px;
}

/* Action Grid */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}
.action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}
.action-item:nth-child(3n) { border-right: none; }
.action-item:nth-child(n+4) { border-bottom: none; }
.action-item:active { background: var(--bg-secondary); }
.action-item i { font-size: 22px; }
.action-item span { font-size: 11px; font-weight: 600; }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #000;
    border-top: 1px solid #1a1a1a;
    display: flex;
    z-index: 100;
    max-width: 100%;
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    text-decoration: none;
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    font-weight: 600;
    gap: 2px;
}
.bottom-nav a.active { color: #fff; }
.bottom-nav a i { font-size: 20px; }
.bottom-nav a { position: relative; }
.bottom-nav .nav-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(18px);
    background: #fe2c55;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    line-height: 1.4;
}

/* Page wrapper */
.page-content {
    padding-bottom: 70px;
}

/* Guide list items */
.guide-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
}
.guide-item:last-child { border-bottom: none; }
.guide-item:active { background: var(--bg-secondary); }

/* Forms */
.tk-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    background: var(--bg-secondary);
    transition: border-color 0.2s;
}
.tk-input:focus {
    border-color: var(--text-secondary);
    background: #fff;
}
.tk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.tk-btn:active { opacity: 0.8; }
.tk-btn-primary {
    background: #000;
    color: #fff;
}
.tk-btn-outline {
    background: #fff;
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.tk-btn-success {
    background: var(--success);
    color: #fff;
}
.tk-btn-danger {
    background: var(--danger);
    color: #fff;
}
.tk-btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    width: auto;
    border-radius: 8px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved, .status-completed, .status-active { background: #d1fae5; color: #065f46; }
.status-rejected, .status-frozen, .status-cancelled { background: #fee2e2; color: #991b1b; }
.status-processing { background: #dbeafe; color: #1e40af; }
.status-delivered { background: #e0e7ff; color: #3730a3; }

/* Table styles */
.tk-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tk-card > .tk-table-wrap:last-child .tk-table tr:last-child td {
    border-bottom: none;
}
.tk-table {
    width: 100%;
    font-size: 13px;
}
.tk-table th {
    background: var(--bg-secondary);
    padding: 10px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
.tk-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.tk-table tr:hover { background: var(--bg-secondary); }

/* Alert / Flash */
.tk-alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin: 12px;
    font-size: 13px;
    font-weight: 500;
}
.tk-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.tk-alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.tk-alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* Login page */
.login-page {
    min-height: 100vh;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo h1 {
    font-size: 22px;
    font-weight: 800;
}
.login-logo p {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* Stat cards */
.stat-row {
    display: grid;
    gap: 8px;
    padding: 0 12px;
}
.stat-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.stat-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.stat-box {
    text-align: center;
    padding: 12px;
}
.stat-box .val {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
}
.stat-box .lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Chat styles */
.chat-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 16px;
}
.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
}
.chat-msg-mine {
    background: #000;
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.chat-msg-other {
    background: var(--border-light);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}
.chat-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}
.chat-input-row input {
    flex: 1;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; display: block; }
.empty-state h4 { color: var(--text-secondary); font-size: 14px; }
.empty-state p { font-size: 12px; margin-top: 4px; }

/* Admin specific */
.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: var(--bg-primary);
    color: #fff;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s;
}
.admin-sidebar .brand {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.admin-sidebar .brand h2 {
    font-size: 16px;
    font-weight: 800;
}
.admin-sidebar .brand p {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}
.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
}
.admin-sidebar .nav-item:hover,
.admin-sidebar .nav-item.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.admin-sidebar .nav-item i { width: 18px; text-align: center; }
.admin-sidebar .nav-section {
    padding: 16px 20px 8px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.3);
}

.admin-content {
    margin-left: 260px;
    padding: 24px;
    min-height: 100vh;
    transition: margin-left 0.3s;
}
.admin-sidebar {
    transition: transform 0.3s;
}
.admin-sidebar.collapsed {
    transform: translateX(-260px);
}
.admin-sidebar.collapsed + .admin-content {
    margin-left: 0;
}
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.admin-topbar h1 {
    font-size: 18px;
    font-weight: 800;
}

@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-260px); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-sidebar.collapsed { transform: translateX(-260px); }
    .admin-content { margin-left: 0; }
    .admin-sidebar.open + .admin-content { margin-left: 0; }
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
}

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal-box h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* Settings grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* Customer service & messenger responsive grids */
.cs-grid, .msg-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 16px;
    min-height: 500px;
}
.cs-back, .msg-back {
    display: none;
    color: inherit;
    text-decoration: none;
    margin-right: 8px;
}

/* Detail grid helper */
.detail-grid-2 { align-items: start; }

/* Mobile responsive overrides */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .admin-content { padding: 16px; }
    .admin-topbar { margin-bottom: 16px; }
    .admin-topbar h1 { font-size: 15px; }

    .tk-table-wrap .tk-table { min-width: 600px; }

    .detail-grid-2 { grid-template-columns: 1fr !important; }
    .cs-grid, .msg-grid { grid-template-columns: 1fr; }
    .cs-back, .msg-back { display: inline; }
    .cs-grid .cs-chat { order: -1; }
    .settings-grid { grid-template-columns: 1fr; }
}

/* Announcement Bar */
.announcement-bar {
    background: linear-gradient(90deg, #0f172a, #1e293b);
    color: #fff;
    padding: 8px 16px;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}
.announcement-inner {
    display: inline-block;
    animation: marquee 25s linear infinite;
}
.announcement-label {
    display: inline-block;
    background: #fe2c55;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 10px;
    text-transform: uppercase;
}
.announcement-text {
    font-size: 13px;
    color: #e2e8f0;
}
@keyframes marquee {
    0% { transform: translateX(100vw); }
    100% { transform: translateX(-100%); }
}

/* Admin table styles */
.tk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.tk-table th {
    text-align: left;
    padding: 10px 12px;
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}
.tk-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.tk-table tbody tr:hover {
    background: #f8fafc;
}
.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}
.status-active {
    background: #d1fae5;
    color: #065f46;
}
.status-inactive {
    background: #fee2e2;
    color: #991b1b;
}
.status-pending {
    background: #fef3c7;
    color: #92400e;
}

@media (max-width: 480px) {
    .bottom-nav a { font-size: 9px; }
    .bottom-nav a i { font-size: 17px; }
    .tk-card { margin: 8px; }
    .client-header { padding: 12px 12px; }
}
