:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --sidebar: #111827;
    --sidebar-soft: #1f2937;
    --text: #18212f;
    --muted: #6b7280;
    --border: #e4e9f0;
    --primary: #d79b16;
    --primary-dark: #af7608;
    --primary-soft: #fff6d9;
    --success: #0d9f6e;
    --success-soft: #e7f8f1;
    --danger: #dc3c4c;
    --danger-soft: #fff0f1;
    --info: #2563eb;
    --shadow: 0 12px 35px rgba(15, 23, 42, 0.07);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

button,
input,
select,
textarea {
    font: inherit;
}

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

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

.sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    width: 274px;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--sidebar), #0b1220);
    color: #d7dfeb;
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.12);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #f5c44d, var(--primary-dark));
    color: #111827;
    font-size: 24px;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(215, 155, 22, 0.28);
}

.brand-mark.large {
    width: 64px;
    height: 64px;
    margin: 0 auto;
    border-radius: 19px;
    font-size: 34px;
}

.brand strong {
    display: block;
    color: #fff;
    font-size: 20px;
}

.brand span {
    display: block;
    color: #8f9bad;
    font-size: 12px;
}

.nav-menu {
    display: grid;
    gap: 7px;
    padding: 24px 14px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 11px;
    color: #b7c2d2;
    font-weight: 700;
    transition: 0.2s ease;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(215, 155, 22, 0.22), rgba(215, 155, 22, 0.08));
    color: #ffd66f;
    box-shadow: inset -3px 0 0 var(--primary);
}

.nav-icon {
    display: grid;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    font-size: 18px;
    line-height: 1;
}

.receipt-icon {
    color: #44d7a4;
}

.payment-icon {
    color: #ff7a86;
}

.sidebar-footer {
    margin-top: auto;
    padding: 17px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.avatar {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border-radius: 50%;
    background: var(--primary);
    color: #172033;
    font-weight: 900;
}

.user-card strong,
.user-card small {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-card strong {
    color: #f8fafc;
    font-size: 13px;
}

.user-card small {
    direction: ltr;
    color: #8390a3;
    font-size: 11px;
}

.logout-button {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    cursor: pointer;
}

.logout-button:hover {
    background: rgba(220, 60, 76, 0.15);
    color: #ffb3ba;
}

.main-content {
    min-height: 100vh;
    margin-right: 274px;
}

.topbar {
    position: sticky;
    z-index: 30;
    top: 0;
    display: flex;
    min-height: 84px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 15px 28px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 13px;
}

.topbar h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
}

.topbar p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.date-chip {
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
}

.menu-button {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
}

.content-area {
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.quick-actions,
.panel-actions,
.form-actions,
.filter-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.quick-actions {
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    min-height: 41px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    transition: 0.18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, #e2aa2c, var(--primary-dark));
    color: #131b29;
    box-shadow: 0 7px 16px rgba(215, 155, 22, 0.18);
}

.btn-primary:hover {
    box-shadow: 0 9px 20px rgba(215, 155, 22, 0.28);
}

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

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

.btn-secondary {
    border-color: var(--border);
    background: #fff;
    color: #39445a;
}

.btn-block {
    width: 100%;
}

.cashbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.balance-card {
    position: relative;
    min-height: 225px;
    overflow: hidden;
    padding: 24px;
    border-radius: 20px;
    color: #fff;
    box-shadow: var(--shadow);
}

.balance-card::after {
    position: absolute;
    width: 210px;
    height: 210px;
    border: 42px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    content: '';
    left: -75px;
    bottom: -125px;
}

.usd-card {
    background: linear-gradient(135deg, #123c31, #0b6a4d);
}

.syp-card {
    background: linear-gradient(135deg, #1c2740, #33466c);
}

.balance-card-head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.eyebrow {
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.balance-card h2 {
    margin: 4px 0 0;
    font-size: 17px;
}

.currency-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: #8c5b00;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.4px;
}

.balance-card .currency-badge {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
}

.balance-value {
    position: relative;
    z-index: 2;
    margin: 25px 0;
    direction: ltr;
    text-align: right;
    font-size: clamp(27px, 3vw, 40px);
    font-weight: 900;
    letter-spacing: -1px;
}

.balance-value small {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.75;
}

.balance-breakdown {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: 11px;
}

.balance-breakdown span {
    color: rgba(255, 255, 255, 0.68);
}

.balance-breakdown strong {
    margin-right: 3px;
    color: #fff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    font-size: 26px;
}

.panel {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 19px 21px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    margin: 0;
    font-size: 17px;
}

.panel-header p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.text-link {
    color: var(--primary-dark);
    font-weight: 800;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th,
td {
    padding: 13px 16px;
    border-bottom: 1px solid #edf0f4;
    text-align: right;
    vertical-align: middle;
}

th {
    background: #fafbfc;
    color: #667085;
    font-size: 11px;
    font-weight: 900;
}

tbody tr:hover {
    background: #fcfcfd;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.muted,
.notes-cell {
    max-width: 250px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
}

.type-badge {
    display: inline-block;
    min-width: 52px;
    padding: 4px 9px;
    border-radius: 999px;
    text-align: center;
    font-size: 11px;
    font-weight: 900;
}

.type-badge.receipt {
    background: var(--success-soft);
    color: var(--success);
}

.type-badge.payment {
    background: var(--danger-soft);
    color: var(--danger);
}

.amount {
    direction: ltr;
    text-align: right;
    font-weight: 900;
}

.amount.receipt,
.text-success {
    color: var(--success);
}

.amount.payment,
.text-danger {
    color: var(--danger);
}

.empty-state {
    padding: 38px;
    color: var(--muted);
    text-align: center;
}

.actions {
    display: flex;
    align-items: center;
    gap: 11px;
}

.actions form {
    margin: 0;
}

.action-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--info);
    font-weight: 800;
    cursor: pointer;
}

.print-link {
    color: var(--primary-dark);
}

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

.alert {
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    transition: opacity 0.3s ease;
}

.alert ul {
    margin: 7px 0 0;
    padding-right: 20px;
}

.alert-success {
    border-color: #bcebd9;
    background: var(--success-soft);
    color: #087755;
}

.alert-danger {
    border-color: #ffd0d5;
    background: var(--danger-soft);
    color: #b22030;
}

.alert-info {
    border-color: #cfe0ff;
    background: #eff5ff;
    color: #1f56b4;
}

.fade-out {
    opacity: 0;
}

.form-panel {
    max-width: 920px;
}

.form-panel form,
.account-grid .form-stack {
    padding: 22px;
}

.form-grid,
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.filter-grid {
    grid-template-columns: 1.4fr repeat(4, minmax(130px, 1fr)) auto;
    align-items: end;
    padding: 18px;
}

.compact-filter {
    grid-template-columns: 1.5fr repeat(3, minmax(140px, 1fr)) auto;
}

.form-stack {
    display: grid;
    gap: 17px;
}

.form-group {
    display: grid;
    gap: 7px;
}

.form-group label {
    color: #3c4658;
    font-size: 12px;
    font-weight: 800;
}

.required {
    color: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--text);
    transition: 0.15s ease;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #d8a128;
    box-shadow: 0 0 0 3px rgba(215, 155, 22, 0.13);
}

.full-width {
    grid-column: 1 / -1;
}

.type-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.type-option {
    position: relative;
    cursor: pointer;
}

.type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.type-option span {
    display: grid;
    min-height: 78px;
    align-content: center;
    padding: 13px 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    transition: 0.18s ease;
}

.type-option strong,
.type-option small {
    display: block;
}

.type-option strong {
    font-size: 16px;
}

.type-option small {
    color: var(--muted);
    font-weight: 400;
}

.receipt-option input:checked + span {
    border-color: var(--success);
    background: var(--success-soft);
    color: var(--success);
}

.payment-option input:checked + span {
    border-color: var(--danger);
    background: var(--danger-soft);
    color: var(--danger);
}

.form-actions {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.summary-card {
    padding: 15px 18px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #fff;
}

.summary-title {
    margin-bottom: 7px;
    font-weight: 900;
}

.summary-values {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    font-size: 12px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px;
    border-top: 1px solid var(--border);
}

.page-link,
.page-status {
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
}

.page-link:not(.disabled):hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.page-link.disabled {
    color: #b0b8c4;
}

.notice-box {
    margin-bottom: 20px;
    padding: 14px 17px;
    border: 1px solid #f0d58d;
    border-radius: 12px;
    background: var(--primary-soft);
    color: #78520b;
}

.cashbox-settings-grid,
.account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.cashbox-settings-card {
    padding: 21px;
}

.cashbox-settings-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.cashbox-settings-head h2 {
    margin: 8px 0 0;
    font-size: 18px;
}

.current-mini-balance {
    text-align: left;
}

.current-mini-balance small,
.current-mini-balance strong {
    display: block;
}

.current-mini-balance small {
    color: var(--muted);
    font-size: 11px;
}

.current-mini-balance strong {
    direction: ltr;
    font-size: 19px;
}

.cashbox-totals {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin: 20px 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--surface-soft);
    font-size: 12px;
}

.inline-settings-form {
    display: flex;
    align-items: end;
    gap: 10px;
}

.inline-settings-form .form-group {
    flex: 1;
}

.details-list {
    margin: 0;
    padding: 12px 21px 21px;
}

.details-list div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.details-list div:last-child {
    border-bottom: 0;
}

.details-list dt {
    color: var(--muted);
}

.details-list dd {
    margin: 0;
    font-weight: 800;
}

.user-management-panel {
    grid-column: 1 / -1;
}

.user-form-panel {
    max-width: 1180px;
}

.role-badge,
.status-badge {
    display: inline-flex;
    min-width: 68px;
    align-items: center;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2f7;
    color: #4b5563;
    font-size: 11px;
    font-weight: 900;
}

.role-badge.admin {
    background: var(--primary-soft);
    color: #855700;
}

.status-badge.active {
    background: var(--success-soft);
    color: var(--success);
}

.status-badge.inactive {
    background: var(--danger-soft);
    color: var(--danger);
}

.user-status-option {
    align-items: flex-start;
    width: fit-content;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text);
}

.user-status-option span,
.user-status-option strong,
.user-status-option small {
    display: block;
}

.user-status-option small {
    margin-top: 2px;
    color: var(--muted);
}

.permissions-section {
    margin: 22px -22px 0;
    padding: 22px;
    border-top: 1px solid var(--border);
    background: var(--surface-soft);
}

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

.permissions-heading h3,
.permissions-heading p {
    margin: 0;
}

.permissions-heading h3 {
    font-size: 16px;
}

.permissions-heading p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.permission-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.permission-note {
    margin-bottom: 16px;
    font-size: 12px;
}

.btn-small {
    min-height: 34px;
    padding: 6px 11px;
    font-size: 11px;
}

.permission-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.permission-group {
    min-width: 0;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.permission-group legend {
    padding: 0 7px;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 900;
}

.permission-option {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px 5px;
    color: #374151;
    cursor: pointer;
}

.permission-option + .permission-option {
    border-top: 1px solid #f0f2f5;
}

.permission-option input {
    width: 17px;
    min-height: 17px;
    margin-top: 2px;
    accent-color: var(--primary-dark);
}

.permission-option span {
    min-width: 0;
}

.access-denied-panel {
    max-width: 620px;
    margin: 40px auto;
    padding: 38px;
    text-align: center;
}

.access-denied-panel h2 {
    margin: 10px 0 5px;
}

.access-denied-panel p {
    margin: 0 0 22px;
    color: var(--muted);
}

.access-denied-icon {
    display: grid;
    width: 58px;
    height: 58px;
    margin: 0 auto;
    place-items: center;
    border-radius: 50%;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 30px;
    font-weight: 900;
}

.login-page {
    display: grid;
    overflow: hidden;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at 20% 15%, #263653 0, #111827 45%, #080d17 100%);
}

.login-decoration {
    position: fixed;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.decoration-one {
    width: 420px;
    height: 420px;
    top: -190px;
    right: -130px;
}

.decoration-two {
    width: 520px;
    height: 520px;
    bottom: -320px;
    left: -120px;
}

.login-card {
    position: relative;
    z-index: 2;
    width: min(430px, 100%);
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.3);
}

.login-brand {
    margin-bottom: 28px;
    text-align: center;
}

.login-brand h1 {
    margin: 12px 0 0;
    font-size: 28px;
}

.login-brand p {
    margin: 3px 0 0;
    color: var(--muted);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    cursor: pointer;
}

.checkbox-row input {
    width: 16px;
    min-height: 16px;
}

.settings-checkbox {
    width: fit-content;
    color: #3c4658;
    font-weight: 700;
}

.paper-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.paper-option {
    position: relative;
    cursor: pointer;
}

.paper-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.paper-option span {
    display: grid;
    min-height: 76px;
    align-content: center;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #fff;
    transition: 0.18s ease;
}

.paper-option strong,
.paper-option small {
    display: block;
}

.paper-option strong {
    font-size: 17px;
}

.paper-option small {
    color: var(--muted);
    font-weight: 400;
}

.paper-option input:checked + span {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: #78520b;
}

body.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(3, 7, 18, 0.68);
}

.modal-card {
    width: min(420px, 100%);
    padding: 27px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.modal-icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 13px;
    place-items: center;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    font-size: 25px;
    font-weight: 900;
}

.modal-card h2 {
    margin: 0;
    font-size: 19px;
}

.modal-card p {
    margin: 8px 0 20px;
    color: var(--muted);
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.login-footer {
    margin: 24px 0 0;
    color: #9aa3b1;
    text-align: center;
    font-size: 11px;
    letter-spacing: 1px;
}

.print-heading {
    display: none;
}

.sidebar-overlay {
    display: none;
}

.wallet-create-panel {
    max-width: none;
}

.field-help {
    color: var(--muted);
    font-size: 11px;
}

.wallet-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.wallet-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.wallet-card {
    position: relative;
}

.wallet-edit-form {
    padding: 20px 20px 8px;
}

.token-reset-form {
    padding: 0 20px 20px;
}

.endpoint-template {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px dashed #d8a128;
    border-radius: 10px;
    background: var(--primary-soft);
}

.endpoint-template span,
.credentials-grid span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.endpoint-template code,
.credentials-grid code,
td code {
    direction: ltr;
    font-family: Consolas, "Courier New", monospace;
    overflow-wrap: anywhere;
    white-space: normal;
}

.secret-panel {
    border-color: #e0af3e;
    background: #fffbeb;
}

.credentials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 20px;
}

.credentials-grid div {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #f0d58d;
    border-radius: 10px;
    background: #fff;
}

.check-status {
    display: inline-flex;
    min-width: 82px;
    justify-content: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2f7;
    color: #4b5563;
    font-size: 11px;
    font-weight: 900;
}

.check-status.processing {
    background: var(--primary-soft);
    color: #855700;
}

.check-status.completed {
    background: var(--success-soft);
    color: var(--success);
}

.check-status.failed {
    background: var(--danger-soft);
    color: var(--danger);
}

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

    .filter-actions {
        align-self: end;
    }
}

@media (max-width: 850px) {
    .sidebar {
        width: 270px;
        transform: translateX(110%);
        transition: transform 0.22s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.show {
        position: fixed;
        z-index: 40;
        inset: 0;
        display: block;
        background: rgba(3, 7, 18, 0.55);
    }

    .main-content {
        margin-right: 0;
    }

    .menu-button {
        display: inline-grid;
        place-items: center;
    }

    .date-chip {
        display: none;
    }

    .content-area {
        padding: 20px;
    }

    .cashbox-grid,
    .cashbox-settings-grid,
    .account-grid,
    .permission-groups,
    .wallet-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .topbar {
        min-height: 74px;
        padding: 12px 16px;
    }

    .topbar h1 {
        font-size: 18px;
    }

    .content-area {
        padding: 15px;
    }

    .cashbox-grid,
    .stats-grid,
    .summary-grid,
    .form-grid,
    .filter-grid,
    .type-selector,
    .paper-options {
        grid-template-columns: 1fr;
    }

    .credentials-grid {
        grid-template-columns: 1fr;
    }

    .balance-card {
        min-height: 210px;
        padding: 20px;
    }

    .stats-grid {
        gap: 10px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .permissions-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline-settings-form {
        align-items: stretch;
        flex-direction: column;
    }

    .login-card {
        padding: 26px 20px;
    }
}

@media print {
    @page {
        margin: 12mm;
        size: A4 landscape;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 10px;
    }

    .sidebar,
    .sidebar-overlay,
    .topbar,
    .no-print,
    .alert,
    .modal-backdrop {
        display: none !important;
    }

    .main-content {
        margin: 0;
    }

    .content-area {
        width: 100%;
        max-width: none;
        padding: 0;
    }

    .panel {
        border: 0;
        box-shadow: none;
    }

    .panel-header {
        padding: 0 0 12px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        margin-bottom: 12px;
    }

    .summary-card {
        padding: 8px 10px;
    }

    .print-heading {
        display: block;
        margin-bottom: 12px;
        text-align: center;
    }

    .print-heading h2,
    .print-heading p {
        margin: 0 0 4px;
    }

    table {
        white-space: normal;
    }

    th,
    td {
        padding: 6px;
        border: 1px solid #bbb;
        color: #000 !important;
    }

    .type-badge {
        border: 1px solid #888;
        background: transparent !important;
        color: #000 !important;
    }
}
