/* Hệ thiết kế dùng chung, trích từ giao diện quản trị nền tảng. */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-main: #f8fafc;
    --bg-sidebar: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-hover: #ffffff;
    --sidebar-active-bg: #1e293b;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-main);
    min-height: 100vh;
}

/* Bố cục chính */
.plat-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar bên trái cố định */
.plat-sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
}

.plat-brand {
    padding: 20px 24px;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.plat-brand-badge {
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.plat-menu {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.plat-menu-item {
    margin-bottom: 2px;
}

.plat-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.15s ease-in-out;
}

.plat-menu-link:hover {
    color: var(--sidebar-text-hover);
    background-color: rgba(255, 255, 255, 0.05);
}

.plat-menu-item.active .plat-menu-link {
    color: #ffffff;
    background-color: var(--sidebar-active-bg);
    border-left: 4px solid var(--primary);
}

/* Vùng nội dung chính bên phải */
.plat-main {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar */
.plat-topbar {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.plat-topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.plat-topbar-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.plat-admin-chip {
    background: #eef2ff;
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 13px;
}

/* Vùng thân nội dung */
.plat-content {
    padding: 28px 32px;
    flex: 1;
}

/* Dải thông báo Alert */
.plat-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plat-alert-success {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.plat-alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.plat-alert-warning {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.plat-alert-info {
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Cards & Thẻ thống kê KPI */
.plat-grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.plat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 24px;
}

.plat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.plat-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.plat-kpi-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.plat-kpi-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.plat-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.plat-kpi-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Bảng dữ liệu */
.plat-table-responsive {
    width: 100%;
    overflow-x: auto;
}

.plat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.plat-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.plat-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.plat-table tr:hover td {
    background-color: #f8fafc;
}

/* Badges trạng thái */
.plat-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.plat-badge-success { background: #d1fae5; color: #065f46; }
.plat-badge-warning { background: #fef3c7; color: #92400e; }
.plat-badge-danger  { background: #fee2e2; color: #991b1b; }
.plat-badge-info    { background: #dbeafe; color: #1e40af; }
.plat-badge-neutral { background: #f1f5f9; color: #475569; }

/* Nút bấm Buttons */
.plat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 16px;
    height: 38px;
    min-height: 38px;
    box-sizing: border-box;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
}

.plat-btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

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

.plat-btn-secondary {
    background-color: #ffffff;
    color: var(--text-main);
    border-color: var(--border-color);
}

.plat-btn-secondary:hover {
    background-color: #f8fafc;
}

.plat-btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.plat-btn-danger:hover {
    background-color: #dc2626;
}

.plat-btn-success {
    background-color: var(--success);
    color: #ffffff;
}

.plat-btn-success:hover {
    background-color: #059669;
}

.plat-btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Thanh bộ lọc & Tìm kiếm */
.plat-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.plat-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plat-form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.plat-form-control {
    height: 38px;
    padding: 0 12px;
    font-size: 13.5px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text-main);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease-in-out;
}

.plat-form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea.plat-form-control {
    min-height: 80px;
    resize: vertical;
}

/* Phân trang */
.plat-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
    min-height: 36px;
    gap: 12px;
}

.plat-pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.plat-pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-main);
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1;
}

.plat-pagination-link.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    font-weight: 600;
}

.plat-pagination-link:hover:not(.active) {
    background: #f1f5f9;
}

/* Trang đăng nhập */
.plat-login-box {
    width: 100%;
    max-width: 400px;
    margin: 80px auto;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 32px;
}

.plat-login-header {
    text-align: center;
    margin-bottom: 24px;
}

.plat-login-header h1 {
    font-size: 20px;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* Thành phần web người dùng dùng chung cùng token và kiểu hiển thị với platform. */
body.web-authenticated .card,
body.web-public .card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 24px;
}

body.web-authenticated .grid,
body.web-public .grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

body.web-authenticated .grid th,
body.web-public .grid th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

body.web-authenticated .grid td,
body.web-public .grid td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

body.web-authenticated .grid tr:hover td,
body.web-public .grid tr:hover td {
    background-color: #f8fafc;
}

body.web-authenticated .badge,
body.web-public .badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    line-height: 1.4;
    white-space: nowrap;
    background: #f1f5f9;
    color: #475569;
}

body.web-authenticated .badge.st-active,
body.web-authenticated .badge.st-approved,
body.web-authenticated .badge.st-success,
body.web-public .badge.st-active,
body.web-public .badge.st-approved,
body.web-public .badge.st-success {
    background: #d1fae5;
    color: #065f46;
}

body.web-authenticated .badge.st-pending,
body.web-public .badge.st-pending {
    background: #fef3c7;
    color: #92400e;
}

body.web-authenticated .badge.st-suspended,
body.web-authenticated .badge.st-rejected,
body.web-authenticated .badge.st-error,
body.web-public .badge.st-suspended,
body.web-public .badge.st-rejected,
body.web-public .badge.st-error {
    background: #fee2e2;
    color: #991b1b;
}

body.web-authenticated .badge.st-cancelled,
body.web-authenticated .badge.st-neutral,
body.web-authenticated .badge.st-inactive,
body.web-public .badge.st-cancelled,
body.web-public .badge.st-neutral,
body.web-public .badge.st-inactive {
    background: #f1f5f9;
    color: #475569;
}

body.web-authenticated .btn,
body.web-public .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    background-color: var(--primary);
    color: #fff;
}

body.web-authenticated .btn:hover,
body.web-public .btn:hover {
    background-color: var(--primary-hover);
}

body.web-authenticated .btn-secondary,
body.web-public .btn-secondary {
    background-color: #fff;
    color: var(--text-main);
    border-color: var(--border-color);
}

body.web-authenticated .btn-secondary:hover,
body.web-public .btn-secondary:hover {
    background-color: #f8fafc;
}

body.web-authenticated .btn-danger,
body.web-public .btn-danger {
    background-color: var(--danger);
    color: #fff;
}

body.web-authenticated .btn-danger:hover,
body.web-public .btn-danger:hover {
    background-color: #dc2626;
}

body.web-authenticated .btn-success,
body.web-public .btn-success {
    background-color: var(--success);
    color: #fff;
}

body.web-authenticated .btn-success:hover,
body.web-public .btn-success:hover {
    background-color: #059669;
}

body.web-authenticated .btn-link,
body.web-public .btn-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

body.web-authenticated .plat-form-control,
body.web-authenticated input[type="text"],
body.web-authenticated input[type="email"],
body.web-authenticated input[type="password"],
body.web-authenticated input[type="number"],
body.web-authenticated input[type="date"],
body.web-authenticated input[type="month"],
body.web-authenticated input[type="time"],
body.web-authenticated input[type="search"],
body.web-authenticated select,
body.web-authenticated textarea,
body.web-public .plat-form-control,
body.web-public input[type="text"],
body.web-public input[type="email"],
body.web-public input[type="password"],
body.web-public input[type="number"],
body.web-public input[type="date"],
body.web-public input[type="month"],
body.web-public input[type="time"],
body.web-public input[type="search"],
body.web-public select,
body.web-public textarea {
    padding: 8px 12px;
    font: inherit;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #fff;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

body.web-authenticated input[type="text"]:focus,
body.web-authenticated input[type="email"]:focus,
body.web-authenticated input[type="password"]:focus,
body.web-authenticated input[type="number"]:focus,
body.web-authenticated input[type="date"]:focus,
body.web-authenticated input[type="month"]:focus,
body.web-authenticated input[type="time"]:focus,
body.web-authenticated input[type="search"]:focus,
body.web-authenticated select:focus,
body.web-authenticated textarea:focus,
body.web-public input[type="text"]:focus,
body.web-public input[type="email"]:focus,
body.web-public input[type="password"]:focus,
body.web-public input[type="number"]:focus,
body.web-public input[type="date"]:focus,
body.web-public input[type="month"]:focus,
body.web-public input[type="time"]:focus,
body.web-public input[type="search"]:focus,
body.web-public select:focus,
body.web-public textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

body.web-authenticated textarea,
body.web-public textarea {
    min-height: 80px;
    resize: vertical;
}

body.web-authenticated label,
body.web-public label {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
}

body.web-authenticated .flash,
body.web-authenticated .ds-alert,
body.web-public .flash,
body.web-public .ds-alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    background-color: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

body.web-authenticated .summary-box,
body.web-public .summary-box {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #f8fafc;
}

body.web-authenticated .table-responsive,
body.web-public .table-responsive {
    width: 100%;
    overflow-x: auto;
}

body.web-authenticated .filters,
body.web-public .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

body.web-authenticated .filters label,
body.web-public .filters label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.web-authenticated .filters input,
body.web-authenticated .filters select,
body.web-public .filters input,
body.web-public .filters select {
    min-width: 160px;
}

body.web-authenticated .empty-state,
body.web-public .empty-state {
    padding: 20px;
    color: var(--text-muted);
    text-align: center;
}

body.web-authenticated .table-tools,
body.web-public .table-tools {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

body.web-authenticated .table-tools label,
body.web-public .table-tools label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

body.web-authenticated .table-tools input,
body.web-authenticated .table-tools select,
body.web-public .table-tools input,
body.web-public .table-tools select {
    min-width: 200px;
}

body.web-authenticated .table-pagination,
body.web-public .table-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

body.web-authenticated .table-pagination .btn,
body.web-public .table-pagination .btn {
    min-width: 40px;
    margin: 0;
}

body.web-authenticated .ds-confirm-dialog,
body.web-public .ds-confirm-dialog {
    width: min(440px, calc(100vw - 32px));
    margin: auto;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-main);
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

body.web-authenticated .ds-confirm-dialog::backdrop,
body.web-public .ds-confirm-dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
}

body.web-authenticated .ds-confirm-dialog h2,
body.web-public .ds-confirm-dialog h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

body.web-authenticated .ds-confirm-dialog p,
body.web-public .ds-confirm-dialog p {
    margin: 0 0 20px;
    color: var(--text-muted);
}

body.web-authenticated .ds-confirm-actions,
body.web-public .ds-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

body.web-authenticated .numeric,
body.web-public .numeric {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
}
