:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --text: #172033;
    --muted: #64748b;
    --border: #dbe3ef;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #b45309;
    --sidebar: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #1e293b;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 1.45rem;
    margin: 0;
}

h2 {
    font-size: 1.05rem;
    margin: 0 0 0.75rem;
}

.muted {
    color: var(--muted);
}

.pre-line {
    white-space: pre-line;
}

.center {
    text-align: center;
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    gap: 1.5rem;
    flex-shrink: 0;
}

.brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0 0.5rem;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.brand-product {
    font-size: 0.78rem;
    color: #94a3b8;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav a {
    color: var(--sidebar-text);
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    font-size: 0.92rem;
}

.nav a:hover {
    background: var(--sidebar-active);
    text-decoration: none;
}

.nav a.active {
    background: var(--primary);
    color: #ffffff;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.topbar-title {
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.user-name {
    color: var(--muted);
    font-size: 0.9rem;
}

.lang-form {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.lang-button {
    border: 0;
    background: transparent;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--muted);
}

.lang-button.active {
    background: var(--primary);
    color: #ffffff;
}

.content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-head p {
    margin: 0.35rem 0 0;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    color: var(--text);
}

.stat-card:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.stat-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-draft .stat-value { color: var(--muted); }
.stat-submitted .stat-value { color: var(--warning); }
.stat-approved .stat-value { color: var(--success); }
.stat-rejected .stat-value { color: var(--danger); }

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.mini-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
}

.mini-card strong {
    color: var(--text);
    font-size: 1.2rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    padding: 0.6rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table tbody tr:hover {
    background: var(--surface-alt);
}

.actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
}

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

.badge-draft { background: #e2e8f0; color: #475569; }
.badge-submitted { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.55rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.button:hover {
    text-decoration: none;
}

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

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    background: #e0e7ff;
    color: var(--primary-dark);
}

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

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

.button-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.button-block {
    width: 100%;
}

.link {
    color: var(--primary);
    font-size: 0.88rem;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.link-button.danger {
    color: var(--danger);
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.field-wide {
    grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea,
.filters-grid input,
.filters-grid select,
.action-form input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    color: var(--text);
    background: #ffffff;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid #bfdbfe;
    border-color: var(--primary);
}

.input-compact {
    min-width: 110px;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
}

.checkbox-field {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: end;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.flash {
    border-radius: var(--radius);
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.flash-success { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.flash-danger { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.flash-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.flash-info { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }

.error-list {
    margin: 0.5rem 0 0 1.1rem;
    padding: 0;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.detail-grid .label,
.detail-block .label {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.detail-block {
    margin-top: 1rem;
}

.detail-block p {
    margin: 0;
}

.action-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.action-form input {
    width: 280px;
}

.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.attachment-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
    padding: 1.25rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.auth-brand .brand-name {
    color: var(--text);
    font-size: 1.4rem;
}

.auth-brand .brand-product {
    color: var(--muted);
}

.auth-lang {
    align-self: flex-end;
}

.auth-title {
    margin: 0;
}

@media (max-width: 1100px) {
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; align-items: center; overflow-x: auto; padding: 0.75rem; }
    .brand { display: none; }
    .nav { flex-direction: row; }
    .nav a { white-space: nowrap; }
    .topbar { flex-wrap: wrap; }
    .content { padding: 1rem; }
    .form-grid,
    .filters-grid,
    .detail-grid { grid-template-columns: 1fr; }
    .action-form input { width: 100%; }
}
