:root {
    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    --amber-700: #b45309;
    --amber-900: #78350f;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-900: #111827;
    --red-500: #ef4444;
    --white: #ffffff;
    --sidebar-width: 16rem;
    --radius-lg: 0.5rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

* { box-sizing: border-box; }

body.admin-body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--white);
    color: var(--gray-900);
}

.admin-shell {
    display: flex;
    height: 100vh;
    background: var(--white);
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.admin-sidebar-brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
}

.admin-sidebar-brand h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
}

.admin-sidebar-brand .brand-accent {
    color: var(--amber-600);
}

.admin-sidebar-brand p {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.admin-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.admin-nav-item,
.admin-nav-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.admin-nav-item:hover,
.admin-nav-toggle:hover {
    background: var(--gray-50);
}

.admin-nav-item.active,
.admin-nav-toggle.active {
    background: var(--amber-100);
    color: var(--amber-900);
    box-shadow: var(--shadow-sm);
}

.admin-nav-toggle {
    justify-content: space-between;
}

.admin-nav-toggle .left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-nav-sub {
    margin-top: 0.25rem;
    margin-left: 1rem;
    display: none;
}

.admin-nav-sub.open {
    display: block;
}

.admin-nav-sub .admin-nav-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.admin-nav-sub .admin-nav-item.active {
    background: var(--amber-50);
    color: var(--amber-900);
    box-shadow: none;
}

.admin-nav-item svg,
.admin-nav-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.admin-nav-sub .admin-nav-item svg {
    width: 1.125rem;
    height: 1.125rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.sidebar-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.sidebar-logout-btn:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.sidebar-logout-btn svg {
    width: 1rem;
    height: 1rem;
}

/* Main */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.admin-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.admin-header-inner {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.5rem;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-icon-btn {
    position: relative;
    padding: 0.5rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-lg);
    color: var(--gray-600);
    cursor: pointer;
}

.admin-icon-btn:hover {
    background: var(--gray-100);
}

.admin-icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.admin-notify-dot {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--red-500);
    border-radius: 999px;
}

.admin-user-block {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid var(--gray-200);
}

.admin-user-meta {
    text-align: right;
}

.admin-user-meta strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
}

.admin-user-meta span {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.admin-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: var(--amber-100);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--amber-700);
}

.admin-avatar svg {
    width: 1.25rem;
    height: 1.25rem;
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: none;
}

.admin-content::-webkit-scrollbar {
    display: none;
}

.admin-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Auth pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 45%, #fef3c7 100%);
}

.auth-panel-left {
    flex: 1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: linear-gradient(160deg, #78350f 0%, #d97706 100%);
    color: #fff;
}

.auth-panel-left-inner {
    max-width: 28rem;
}

.auth-panel-left h2 {
    margin: 0 0 1rem;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
}

.auth-panel-left p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
    opacity: 0.92;
}

.auth-panel-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 26rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgb(0 0 0 / 0.08);
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-brand h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

.auth-brand .brand-accent {
    color: var(--amber-600);
}

.auth-brand p {
    margin: 0.35rem 0 0;
    color: var(--gray-500);
    font-size: 0.875rem;
}

.auth-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-900);
}

.auth-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    outline: none;
}

.auth-input:focus {
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--amber-500);
}

.auth-input-otp {
    letter-spacing: 0.45rem;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 700;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

.auth-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--amber-600);
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.auth-btn:hover {
    background: var(--amber-700);
}

.auth-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-btn-secondary {
    margin-top: 0.75rem;
    background: var(--white);
    color: var(--amber-700);
    border: 1px solid var(--amber-600);
}

.auth-alert {
    padding: 0.75rem 0.875rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.auth-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.auth-timer-box {
    text-align: center;
    margin: 1rem 0 1.25rem;
    padding: 0.875rem;
    background: var(--amber-50);
    border: 1px dashed #fcd34d;
    border-radius: var(--radius-lg);
}

.auth-timer-box span {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.auth-timer-box strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.4rem;
    color: var(--amber-600);
}

.auth-helper {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.auth-link {
    color: var(--gray-500);
    text-decoration: none;
}

.auth-link:hover {
    color: var(--amber-600);
}

.hidden { display: none !important; }

/* Page layout */
.page-stack { display: flex; flex-direction: column; gap: 2rem; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 1.875rem; font-weight: 600; color: var(--gray-900); }
.page-description { margin: 0.5rem 0 0; font-size: 1rem; color: var(--gray-600); }
.page-header-btn {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.75rem 1.25rem;
    background: var(--amber-600); color: #fff; border-radius: 0.75rem; text-decoration: none;
    font-size: 1rem; font-weight: 500; box-shadow: var(--shadow-sm);
}
.page-header-btn:hover { background: var(--amber-700); }
.page-header-btn svg { width: 1.25rem; height: 1.25rem; }
button.page-header-btn { border: none; cursor: pointer; font: inherit; }

.admin-flash { padding: 0.75rem 1rem; border-radius: var(--radius-lg); font-size: 0.875rem; }
.admin-flash-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.admin-flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* Data table card */
.data-card {
    background: var(--white); border: 1px solid var(--gray-200); border-radius: 0.75rem; box-shadow: var(--shadow-sm); overflow: hidden;
}
.data-card-toolbar {
    display: flex; align-items: center; gap: 1rem; padding: 1.25rem; border-bottom: 1px solid var(--gray-200); flex-wrap: wrap;
}
.data-search {
    flex: 1; min-width: 220px; padding: 0.75rem 1rem; border: 1px solid var(--gray-300);
    border-radius: 0.75rem; font-size: 1rem; line-height: 1.5; outline: none; background: var(--white);
}
.data-search:focus { box-shadow: 0 0 0 2px var(--amber-500); border-color: transparent; }
.btn-export {
    display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem;
    background: #16a34a; color: #fff; border-radius: var(--radius-lg); text-decoration: none; font-size: 0.875rem; font-weight: 500; white-space: nowrap;
}
.btn-export:hover { background: #15803d; }
.btn-export svg { width: 1rem; height: 1rem; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100% !important; border-collapse: collapse; }
.admin-table thead th {
    padding: 1rem 1.5rem; text-align: left; font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-600); background: var(--gray-50); border-bottom: 2px solid var(--gray-200);
}
.admin-table tbody td { padding: 1.25rem 1.5rem; border-top: 1px solid var(--gray-200); vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--gray-50); transition: background 0.15s; }
.cell-name { font-size: 1rem; font-weight: 500; color: var(--gray-900); }
.cell-shop { font-size: 0.875rem; font-weight: 500; color: var(--gray-700); }
.cell-muted { font-size: 0.875rem; color: var(--gray-600); }
.text-amber { color: #b45309; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; font-weight: 500; }
.text-emerald { color: #047857; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; font-weight: 500; }
.text-teal { color: #0f766e; font-size: 0.875rem; font-weight: 500; }
.cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; font-weight: 500; color: var(--gray-900); }

.workload-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.workload-high { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.workload-medium { background: var(--amber-100); color: var(--amber-900); border-color: #fde68a; }
.workload-low { background: #fef9c3; color: #a16207; border-color: #fde047; }
.workload-available { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.workload-default { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }

.action-btn-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* Status badges */
.status-badge {
    display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
    font-weight: 500; border: 1px solid; padding: 0.25rem 0.75rem; font-size: 0.75rem;
}
.status-badge-lg { padding: 0.5rem 1rem; font-size: 0.875rem; }
.status-badge-active, .status-toggle.status-badge-active { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
.status-badge-inactive, .status-toggle.status-badge-inactive { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.status-badge-pending { background: var(--amber-100); color: var(--amber-900); border-color: #fde68a; }
.status-badge-production { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.status-badge-ready { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.status-badge-default { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.status-toggle { cursor: pointer; border: 1px solid; font: inherit; }
.font-semibold { font-weight: 600; }

.text-red { color: #dc2626; font-weight: 600; }

.filter-card {
    background: var(--white); border: 1px solid var(--gray-200); border-radius: 0.75rem;
    box-shadow: var(--shadow-sm); padding: 1.25rem;
}
.filter-card-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.filter-icon { width: 1.375rem; height: 1.375rem; color: var(--gray-500); flex-shrink: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-chip {
    padding: 0.625rem 1rem; border: none; border-radius: var(--radius-lg); background: var(--gray-100);
    color: var(--gray-700); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.filter-chip:hover { background: var(--gray-200); }
.filter-chip.active { background: var(--amber-600); color: #fff; box-shadow: var(--shadow-sm); }

.stock-expand-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
    border: none; border-radius: var(--radius-lg); background: transparent; color: var(--gray-600); cursor: pointer;
}
.stock-expand-btn:hover { background: var(--gray-200); }
.stock-child-wrap { padding: 1rem 0 0.5rem 2.5rem; }
.stock-child-wrap h4 { margin: 0 0 1rem; font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.stock-child-table { width: 100%; border: 1px solid var(--gray-200); border-radius: 0.75rem; overflow: hidden; background: var(--white); }
.stock-child-table thead { background: var(--gray-100); }
.stock-child-table th, .stock-child-table td { padding: 0.75rem 1rem; text-align: left; font-size: 0.875rem; border-top: 1px solid var(--gray-200); }
.stock-child-table tbody tr:hover { background: var(--gray-50); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.progress-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.progress-card { border-radius: 0.75rem; border: 1px solid; padding: 1rem; }
.progress-card p { margin: 0; font-size: 0.875rem; font-weight: 500; }
.progress-card strong { display: block; margin-top: 0.25rem; font-size: 1.5rem; font-weight: 600; }
.progress-card-emerald { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.progress-card-violet { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.progress-card-amber { background: var(--amber-50); border-color: #fde68a; color: var(--amber-900); }

.detail-notes { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-200); }
.detail-notes h3 { margin: 0 0 1rem; font-size: 1.125rem; font-weight: 600; color: var(--gray-900); }
.note-box { background: var(--amber-50); border: 1px solid #fde68a; border-radius: 0.75rem; padding: 1rem; color: var(--gray-700); font-size: 0.875rem; }

.timeline-list { display: flex; flex-direction: column; gap: 1rem; }
.timeline-item { display: flex; gap: 1rem; align-items: flex-start; }
.timeline-dot { width: 2.5rem; height: 2.5rem; border-radius: 999px; background: #d1fae5; flex-shrink: 0; margin-top: 0.125rem; }
.timeline-content { flex: 1; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-200); }
.timeline-item:last-child .timeline-content { border-bottom: none; padding-bottom: 0; }
.timeline-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.timeline-head strong { color: var(--gray-900); }
.timeline-head span { color: #047857; font-size: 0.875rem; font-weight: 500; }
.timeline-content p { margin: 0.25rem 0 0; color: var(--gray-600); font-size: 0.875rem; }

.item-media-cell { min-width: 280px; }
.order-items-list { display: flex; flex-direction: column; gap: 1.25rem; }

.order-item-card {
    border: 1px solid var(--gray-200);
    border-radius: 0.875rem;
    overflow: hidden;
    background: var(--white);
    box-shadow: var(--shadow-sm);
}
.order-item-top {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(to bottom, #fafafa, var(--white));
}
.order-item-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.order-item-title-row strong {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--gray-900);
}
.order-item-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}
.order-item-status-pending { background: #fef3c7; color: #92400e; }
.order-item-status-active { background: #ede9fe; color: #5b21b6; }
.order-item-status-done { background: #d1fae5; color: #065f46; }

.order-item-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.order-item-stat {
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid var(--gray-200);
    background: var(--white);
}
.order-item-stat-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
}
.order-item-stat-value {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-900);
}

.order-item-body { padding: 1rem 1.25rem 1.25rem; }

.item-media-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}
.item-media-block {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    min-width: 0;
}
.item-media-block-head {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
}
.item-media-block-head svg { width: 1rem; height: 1rem; color: var(--amber-600); flex-shrink: 0; }
.item-media-block-head em {
    margin-left: auto;
    font-style: normal;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 0.125rem 0.4375rem;
    border-radius: 999px;
}

.item-media-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-content: flex-start;
}
.item-media-thumb {
    display: block;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 0.625rem;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.item-media-thumb:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.item-media-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 0.625rem;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    background: #111827;
}
.media-video-frame--empty {
    background: var(--gray-50);
    border-style: dashed;
}
.media-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #111827;
}

.media-audio-frame {
    display: flex;
    align-items: center;
    min-height: 3.25rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.625rem;
    border: 1px solid var(--gray-200);
    background: linear-gradient(to right, #fffbeb, var(--white));
}
.media-audio-frame--empty {
    background: var(--gray-50);
    border-style: dashed;
    justify-content: center;
}
.media-audio {
    display: block;
    width: 100%;
    height: 2.25rem;
}

.media-file-name {
    margin: 0;
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-media-empty-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    width: 100%;
    height: 100%;
    min-height: 4.5rem;
    color: var(--gray-400);
    text-align: center;
}
.item-media-empty-box svg { width: 1.25rem; height: 1.25rem; }
.item-media-empty-box span { font-size: 0.8125rem; font-weight: 500; }

.item-media-samples {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-100);
}
.item-media-file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: #2563eb;
    text-decoration: none;
}
.item-media-file-link svg { width: 1rem; height: 1rem; }

@media (max-width: 900px) {
    .order-item-stats { grid-template-columns: 1fr; }
    .item-media-row { grid-template-columns: 1fr; }
}

.w-12 { width: 3rem; }

/* Action buttons */
.action-group { display: flex; align-items: center; gap: 0.25rem; }
.action-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
    border: none; border-radius: var(--radius-lg); background: transparent; cursor: pointer; text-decoration: none;
}
.action-btn svg { width: 1.125rem; height: 1.125rem; }
.action-view { color: #2563eb; }
.action-view:hover { background: #eff6ff; }
.action-edit { color: var(--gray-600); }
.action-edit:hover { background: var(--gray-100); }
.action-delete { color: #dc2626; }
.action-delete:hover { background: #fef2f2; }

/* Dashboard */
.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
}
.dashboard-metric-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 0.9375rem;
    transition: box-shadow 0.2s ease;
}
.dashboard-metric-card:hover { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
.dashboard-metric-amber { background: #fffbeb; }
.dashboard-metric-blue { background: #eff6ff; }
.dashboard-metric-emerald { background: #ecfdf5; }
.dashboard-metric-violet { background: #f5f3ff; }
.dashboard-metric-icon { margin-bottom: 1rem; }
.dashboard-metric-icon svg { width: 1.5625rem; height: 1.5625rem; stroke-width: 2; }
.dashboard-metric-amber .dashboard-metric-icon svg { color: #2563eb; }
.dashboard-metric-blue .dashboard-metric-icon svg { color: #7c3aed; }
.dashboard-metric-emerald .dashboard-metric-icon svg { color: #d97706; }
.dashboard-metric-violet .dashboard-metric-icon svg { color: #0d9488; }
.dashboard-metric-label { margin: 0; font-size: 0.875rem; font-weight: 500; color: var(--gray-600); }
.dashboard-metric-value-row { display: flex; align-items: baseline; gap: 0.25rem; margin-top: 0.25rem; }
.dashboard-metric-value { font-size: 1.5rem; font-weight: 600; color: var(--gray-900); }
.dashboard-metric-unit { font-size: 0.875rem; font-weight: 500; color: var(--gray-500); }

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}
.dashboard-grid-3 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
}
.dashboard-panel {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.dashboard-panel-wide { min-width: 0; }
.dashboard-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.dashboard-panel-head h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}
.dashboard-panel-title { display: flex; align-items: center; gap: 0.5rem; }
.dashboard-title-icon { width: 1.125rem; height: 1.125rem; color: var(--amber-600); }
.dashboard-panel-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--gray-600);
}
.dashboard-panel-meta svg { width: 0.875rem; height: 0.875rem; }

.dashboard-pipeline-list { display: flex; flex-direction: column; gap: 0.75rem; }
.dashboard-pipeline-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    border-left: 4px solid transparent;
}
.dashboard-pipeline-item svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.dashboard-pipeline-label { flex: 1; font-size: 0.875rem; font-weight: 500; color: var(--gray-900); }
.dashboard-pipeline-value { font-size: 1.25rem; font-weight: 600; color: var(--gray-900); }
.dashboard-pipeline-amber { background: #fffbeb; border-left-color: #f59e0b; }
.dashboard-pipeline-amber svg { color: #d97706; }
.dashboard-pipeline-blue { background: #eff6ff; border-left-color: #3b82f6; }
.dashboard-pipeline-blue svg { color: #2563eb; }
.dashboard-pipeline-emerald { background: #ecfdf5; border-left-color: #10b981; }
.dashboard-pipeline-emerald svg { color: #059669; }
.dashboard-pipeline-violet { background: #f5f3ff; border-left-color: #8b5cf6; }
.dashboard-pipeline-violet svg { color: #7c3aed; }

.dashboard-gold-panel {
    background: linear-gradient(to bottom right, #fffbeb, #fef9c3);
    border-color: #fde68a;
}
.dashboard-gold-total {
    font-size: 0.75rem;
    font-weight: 600;
    color: #b45309;
    background: #fef3c7;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
}
.dashboard-gold-list { display: flex; flex-direction: column; gap: 0.75rem; }
.dashboard-gold-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 0.625rem;
}
.dashboard-gold-icon { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.dashboard-gold-icon-yellow { color: #ca8a04; }
.dashboard-gold-icon-orange { color: #ea580c; }
.dashboard-gold-icon-violet { color: #7c3aed; }
.dashboard-gold-icon-teal { color: #0d9488; }
.dashboard-gold-copy { flex: 1; min-width: 0; }
.dashboard-gold-copy p { margin: 0; font-size: 0.875rem; font-weight: 500; color: var(--gray-900); }
.dashboard-gold-copy small { color: var(--gray-600); font-size: 0.75rem; }
.dashboard-gold-amount { font-size: 0.875rem; font-weight: 600; color: var(--gray-900); }

.dashboard-performers { display: flex; flex-direction: column; gap: 0.75rem; }
.dashboard-performer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
}
.dashboard-rank {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 700;
    flex-shrink: 0;
}
.dashboard-rank-1 { background: #f59e0b; }
.dashboard-rank-2 { background: #9ca3af; }
.dashboard-rank-3 { background: #ea580c; }
.dashboard-rank-4, .dashboard-rank-5 { background: #d1d5db; }
.dashboard-performer-copy { flex: 1; min-width: 0; }
.dashboard-performer-copy p { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--gray-900); }
.dashboard-performer-copy small { color: var(--gray-600); font-size: 0.75rem; }
.dashboard-performer-stats { text-align: right; }
.dashboard-performer-stats strong { display: block; font-size: 1.125rem; color: var(--gray-900); }
.dashboard-performer-stats small { color: var(--gray-600); font-size: 0.75rem; }

.dashboard-activity-list { display: flex; flex-direction: column; gap: 1rem; }
.dashboard-activity { display: flex; gap: 0.75rem; }
.dashboard-activity-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dashboard-activity-icon svg { width: 1rem; height: 1rem; }
.dashboard-activity-blue { background: #eff6ff; color: #2563eb; }
.dashboard-activity-emerald { background: #ecfdf5; color: #059669; }
.dashboard-activity-violet { background: #f5f3ff; color: #7c3aed; }
.dashboard-activity-orange { background: #fff7ed; color: #ea580c; }
.dashboard-activity-amber { background: #fffbeb; color: #d97706; }
.dashboard-activity-copy { flex: 1; min-width: 0; }
.dashboard-activity-copy p { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--gray-900); }
.dashboard-activity-copy small { display: block; margin-top: 0.125rem; color: var(--gray-600); font-size: 0.75rem; }
.dashboard-activity-copy span { display: block; margin-top: 0.25rem; color: var(--gray-500); font-size: 0.75rem; }
.dashboard-empty { margin: 0; color: var(--gray-500); font-size: 0.875rem; }

/* Ledger pages (A / P) */
.ledger-filter-card { margin: 0; }
.ledger-filter-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
    width: 100%;
}
.ledger-filter-row .filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
}
.ledger-filter-row .btn-export {
    flex: 0 0 auto;
    margin-left: auto;
}
.ledger-table-card .data-card-toolbar { display: none; }
.ledger-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.ledger-type-debit { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.ledger-type-credit { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

.ledger-table-card .dataTables_wrapper .ledger-table-footer,
.data-card.ledger-table-card .dataTables_wrapper .dataTables_info,
.data-card.ledger-table-card .dataTables_wrapper .dataTables_paginate {
    display: flex;
    align-items: center;
}
.ledger-table-card .dataTables_wrapper .ledger-table-footer {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.ledger-table-card .dataTables_wrapper .dataTables_info,
.ledger-table-card .dataTables_wrapper .dataTables_paginate {
    padding: 0 !important;
    border-top: none !important;
    background: transparent !important;
    margin: 0 !important;
    float: none !important;
}

@media (max-width: 900px) {
    .admin-sidebar { display: none; }
    .admin-user-meta { display: none; }
    .data-card-toolbar { flex-direction: column; align-items: stretch; }
    .page-header { flex-direction: column; }
    .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid-2, .dashboard-grid-3 { grid-template-columns: 1fr; }
}
.form-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: 0.75rem; box-shadow: var(--shadow-sm); padding: 2rem; }
.form-section-title { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.form-section-title svg { width: 1.125rem; height: 1.125rem; color: var(--amber-600); }
.form-section-title h3, .form-subtitle { margin: 0; font-size: 1rem; font-weight: 600; color: var(--gray-900); }
.form-subtitle { margin-bottom: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.form-field label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); }
.form-field small { display: block; margin-top: 0.25rem; font-size: 0.75rem; color: var(--gray-500); }
.form-field input, .form-field select, .form-field textarea {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--gray-300); border-radius: var(--radius-lg); font-size: 0.875rem; outline: none; background: var(--white);
}
.form-card .form-field input,
.form-card .form-field select,
.form-card .form-field textarea {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { box-shadow: 0 0 0 2px var(--amber-500); border-color: transparent; }
.form-field-full { grid-column: 1 / -1; }
.form-divider { margin: 1.5rem 0; border-top: 1px solid var(--gray-200); }
.required { color: #ef4444; }
.form-actions { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.form-actions-inline { padding-top: 1rem; border-top: 1px solid var(--gray-200); margin-top: 0; }
.btn-primary-lg, .btn-gradient {
    padding: 0.75rem 1.5rem; border: none; border-radius: var(--radius-lg); background: var(--amber-600); color: #fff;
    font-size: 1rem; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
.btn-primary-lg { border-radius: 0.75rem; }
.btn-primary-lg:hover, .btn-gradient:hover { background: var(--amber-700); }
.btn-gradient { background: linear-gradient(to right, #f59e0b, var(--amber-600)); border-radius: var(--radius-lg); }
.btn-gradient:hover { background: linear-gradient(to right, var(--amber-600), var(--amber-700)); }
.btn-secondary-lg {
    padding: 0.75rem 1.5rem; border-radius: 0.75rem; background: var(--gray-100); color: var(--gray-700);
    font-size: 1rem; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center;
}
.btn-secondary-lg:hover { background: var(--gray-200); }

/* Detail pages */
.detail-header { display: flex; align-items: center; gap: 1rem; }
.detail-header-between { justify-content: space-between; flex-wrap: wrap; }
.back-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
    border-radius: var(--radius-lg); color: var(--gray-700); text-decoration: none;
}
.back-btn:hover { background: var(--gray-100); }
.back-btn svg { width: 1.5rem; height: 1.5rem; }
.detail-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; align-items: start; }
.detail-main { padding: 1.5rem; }
.detail-section-title { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 600; }

.detail-gold-inline {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    border: 1px solid #fde68a;
    background: linear-gradient(to right, var(--amber-50), #fffbeb);
}
.detail-gold-inline-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius-lg);
    background: var(--amber-600);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.detail-gold-inline-icon svg { width: 1.25rem; height: 1.25rem; }
.detail-gold-inline span {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--amber-700);
}
.detail-gold-inline strong {
    display: block;
    margin-top: 0.125rem;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--amber-900);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.detail-gold-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    border: 2px solid #fde68a;
    background: linear-gradient(to bottom right, var(--amber-50), #fffbeb);
    box-shadow: var(--shadow-sm);
}
.detail-gold-card-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    min-height: 11rem;
}
.detail-gold-card-hero-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background: var(--white);
    color: var(--amber-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(180, 83, 9, 0.15);
    margin-bottom: 1rem;
}
.detail-gold-card-hero-icon svg { width: 1.75rem; height: 1.75rem; }
.detail-gold-card-hero-label {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--amber-800);
}
.detail-gold-card-hero-value {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--amber-900);
    letter-spacing: -0.02em;
}
.detail-gold-card-hero-unit {
    margin-left: 0.2rem;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--amber-700);
}

.detail-cost-value {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 600;
    color: #047857;
}
.detail-cost-caption {
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
    color: var(--gray-600);
}
.detail-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.detail-action-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
}
.btn-danger-outline {
    padding: 0.625rem 1rem;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}
.btn-danger-outline:hover { background: #fee2e2; }
.detail-history-card { padding: 1.5rem; }

.detail-side { display: flex; flex-direction: column; gap: 1.5rem; }
.detail-side-card { padding: 1.25rem; }
.detail-side-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}
.timeline-list-compact .timeline-content { padding-bottom: 0.75rem; }
.timeline-list-compact .timeline-dot { width: 2rem; height: 2rem; }

.progress-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.progress-stack .progress-card strong { font-size: 1.25rem; }

.detail-fields { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.detail-fields label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-600); }
.detail-fields p { margin: 0.25rem 0 0; font-size: 1rem; font-weight: 500; color: var(--gray-900); }
.detail-span-2 { grid-column: 1 / -1; }
.balance-card {
    display: flex; align-items: center; gap: 0.75rem; padding: 1.5rem; border-radius: 0.75rem; border: 1px solid; box-shadow: var(--shadow-sm);
}
.balance-card-icon {
    width: 3rem; height: 3rem; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; color: #fff;
}
.balance-card-icon svg { width: 1.5rem; height: 1.5rem; }
.balance-card p { margin: 0; font-size: 0.875rem; font-weight: 500; }
.balance-card strong { display: block; margin-top: 0.25rem; font-size: 1.5rem; font-weight: 600; }
.balance-card-amber { background: linear-gradient(to bottom right, var(--amber-50), var(--amber-100)); border-color: #fde68a; }
.balance-card-amber .balance-card-icon { background: var(--amber-600); }
.balance-card-amber p { color: var(--amber-700); }
.balance-card-amber strong { color: var(--amber-900); }
.balance-card-emerald { background: linear-gradient(to bottom right, #ecfdf5, #d1fae5); border-color: #a7f3d0; }
.balance-card-emerald .balance-card-icon { background: #059669; }
.balance-card-emerald p { color: #047857; }
.balance-card-emerald strong { color: #064e3b; }

.dt-btn-hidden { display: none !important; }

/* DataTables footer — match Figma pagination bar */
.data-card .dataTables_wrapper { width: 100%; }
.data-card .dataTables_wrapper .dataTables_info,
.data-card .dataTables_wrapper .dataTables_paginate {
    padding: 1rem 1.5rem !important;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}
.data-card .dataTables_wrapper .dataTables_info {
    color: var(--gray-600) !important;
    font-size: 0.875rem !important;
    font-weight: 500;
}
.data-card .dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.5rem 1rem !important;
    margin-left: 0.5rem !important;
    border: 2px solid var(--gray-300) !important;
    border-radius: var(--radius-lg) !important;
    background: var(--white) !important;
    color: var(--gray-700) !important;
    font-size: 0.875rem;
    font-weight: 500;
}
.data-card .dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.disabled) {
    background: var(--gray-100) !important;
    color: var(--gray-900) !important;
    border-color: var(--gray-300) !important;
}
.data-card .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.data-card .dataTables_wrapper .dataTables_processing {
    padding: 1rem;
    color: var(--gray-500);
}

/* History */
.history-list { display: flex; flex-direction: column; gap: 1rem; }
.history-item {
    display: flex; gap: 1rem; padding: 1.25rem 1.5rem; background: var(--white);
    border: 1px solid var(--gray-200); border-radius: 0.75rem; box-shadow: var(--shadow-sm);
}
.history-icon {
    width: 2.5rem; height: 2.5rem; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.history-icon svg { width: 1.125rem; height: 1.125rem; }
.history-icon-created { background: #ecfdf5; color: #047857; }
.history-icon-updated { background: #eff6ff; color: #2563eb; }
.history-icon-deleted, .history-icon-force_deleted { background: #fef2f2; color: #dc2626; }
.history-icon-restored { background: var(--amber-50); color: var(--amber-700); }
.history-icon-status_changed { background: #f5f3ff; color: #7c3aed; }
.history-body { flex: 1; min-width: 0; }
.history-description { margin: 0; font-size: 0.9375rem; line-height: 1.6; color: var(--gray-900); }
.history-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.8125rem; color: var(--gray-500); }
.history-module { text-transform: capitalize; }
.history-changes { margin: 0.75rem 0 0; padding-left: 1.25rem; font-size: 0.875rem; color: var(--gray-700); line-height: 1.6; }
.history-changes em { font-style: normal; font-weight: 500; color: var(--gray-900); }
.history-empty { text-align: center; color: var(--gray-500); }
.history-pagination { margin-top: 0.5rem; }

@media (min-width: 768px) {
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .detail-grid-split { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
    .detail-side { position: sticky; top: 1rem; }
}

@media (min-width: 1024px) {
    .auth-panel-left { display: flex; }
}

@media (max-width: 900px) {
    .admin-sidebar { display: none; }
    .admin-user-meta { display: none; }
    .data-card-toolbar { flex-direction: column; align-items: stretch; }
    .page-header { flex-direction: column; }
}
