/* assets/style.css */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    background: #f4f6f9;
    color: #2c3e50;
    line-height: 1.5;
    font-size: 14px;
}
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }

.topbar {
    background: linear-gradient(135deg, #1f4e78 0%, #2a6da8 100%);
    color: white;
    padding: 14px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    margin-bottom: 20px;
}
.topbar .container {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.brand strong { font-size: 18px; display: block; }
.brand .sub { font-size: 12px; opacity: .85; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.topbar nav a {
    color: white; text-decoration: none;
    padding: 8px 14px; border-radius: 6px;
    font-size: 14px; transition: background .2s;
}
.topbar nav a:hover { background: rgba(255,255,255,.2); }
.user-chip {
    padding: 6px 12px; background: rgba(255,255,255,.15);
    border-radius: 16px; font-size: 13px;
}
.user-chip small { opacity: .8; font-size: 11px; }
.logout-link { background: rgba(220,53,69,.85); padding: 6px 12px !important; }
.logout-link:hover { background: #c62828 !important; }

.flash {
    padding: 12px 18px; border-radius: 6px;
    margin-bottom: 16px; border-left: 4px solid;
}
.flash-success { background: #e8f5e9; border-color: #4caf50; color: #2e7d32; }
.flash-error   { background: #ffebee; border-color: #f44336; color: #c62828; }
.flash-info    { background: #e3f2fd; border-color: #2196f3; color: #1565c0; }
.flash-warning { background: #fff3e0; border-color: #ff9800; color: #e65100; }

.card {
    background: white; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    padding: 24px; margin-bottom: 20px;
}
.card h1, .card h2 { color: #1f4e78; margin-bottom: 16px; }
.card h1 { font-size: 22px; }
.card h2 { font-size: 17px; }

.page-head {
    display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.page-head h1 { color: #1f4e78; font-size: 24px; }

.btn {
    display: inline-block; padding: 8px 16px;
    background: #1f4e78; color: white;
    text-decoration: none; border: none; border-radius: 6px;
    cursor: pointer; font-size: 14px; font-family: inherit;
    transition: background .2s, transform .1s;
}
.btn:hover { background: #163c5c; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-danger { background: #c62828; }
.btn-danger:hover { background: #a01e1e; }
.btn-warn { background: #e65100; }
.btn-warn:hover { background: #b64000; }
.btn-success { background: #2e7d32; }
.btn-success:hover { background: #1b5e20; }
.btn-outline {
    background: white; color: #1f4e78;
    border: 1px solid #1f4e78;
}
.btn-outline:hover { background: #1f4e78; color: white; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

.form-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.form-field { display: flex; flex-direction: column; }
.form-field label {
    font-size: 12px; font-weight: 600; color: #555;
    margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px;
}
.form-field input, .form-field select, .form-field textarea {
    padding: 9px 11px; border: 1px solid #ccd;
    border-radius: 5px; font-size: 14px;
    font-family: inherit; background: white;
}
.form-field input:focus, .form-field select:focus {
    outline: none; border-color: #1f4e78;
    box-shadow: 0 0 0 2px rgba(31,78,120,.15);
}
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Auth */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1f4e78 0%, #2a6da8 100%); padding: 20px;
}
.auth-card {
    background: white; padding: 36px; border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2); width: 100%; max-width: 400px;
}
.auth-card h1 { color: #1f4e78; text-align: center; margin-bottom: 6px; font-size: 24px; }
.auth-card .subtitle { text-align: center; color: #777; font-size: 13px; margin-bottom: 24px; }
.auth-card .form-field { margin-bottom: 14px; }
.auth-card .flash { margin-bottom: 16px; }

/* Table */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse; min-width: 900px;
}
table.data th, table.data td {
    padding: 9px 10px; border-bottom: 1px solid #e0e4e9;
    text-align: left; font-size: 13px;
}
table.data th {
    background: #1f4e78; color: white; font-weight: 600;
    font-size: 12px; text-transform: uppercase; letter-spacing: .3px;
    position: sticky; top: 0;
}
table.data tr:hover td { background: #f9fafc; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.center { text-align: center; }
table.data tfoot td {
    background: #eef2f7; font-weight: bold;
    border-top: 2px solid #1f4e78;
}
.actions-cell { white-space: nowrap; display: flex; gap: 4px; }

.input-cell { background: #fff9c4 !important; }
.input-cell input {
    background: transparent; border: 1px solid transparent;
    width: 100%; padding: 4px 6px; font-size: 13px;
    font-family: inherit; font-variant-numeric: tabular-nums;
    text-align: right; border-radius: 3px;
    color: #0000ff; font-weight: 600;
}
.input-cell input:focus {
    outline: none; background: white; border-color: #1f4e78;
}
td.calc { background: #fafafa; color: #555; font-variant-numeric: tabular-nums; }

.stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 20px;
}
.stat {
    background: white; padding: 18px; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08); border-left: 4px solid #1f4e78;
}
.stat .label { font-size: 12px; color: #777; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 24px; font-weight: bold; color: #1f4e78; margin-top: 4px; }

.badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 10px; font-size: 11px; font-weight: 600;
}
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #ffebee; color: #c62828; }
.badge-deleted { background: #f5f5f5; color: #757575; }
.badge-admin { background: #fff3e0; color: #e65100; }
.badge-staff { background: #e3f2fd; color: #1565c0; }

footer { text-align: center; padding: 20px; color: #888; margin-top: 30px; }

/* --- Search bar --- */
.search-bar {
    position: relative; max-width: 520px; margin: 0 auto;
}
.search-bar input {
    width: 100%; padding: 14px 18px; font-size: 16px;
    border: 2px solid #1f4e78; border-radius: 8px;
    background: white; font-family: inherit;
}
.search-bar input:focus {
    outline: none; box-shadow: 0 0 0 3px rgba(31,78,120,.2);
}
.search-results {
    position: absolute; top: 100%; left: 0; right: 0;
    background: white; border: 1px solid #ddd; border-top: none;
    border-radius: 0 0 8px 8px; max-height: 360px; overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.1); z-index: 100;
}
.search-result {
    padding: 12px 16px; cursor: pointer; border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
}
.search-result:hover, .search-result.active { background: #eef2f7; }
.search-result .meta { font-size: 12px; color: #888; }
.search-result .actions { display: flex; gap: 6px; }
.empty-search { padding: 30px; text-align: center; color: #888; }

/* Slip */
.slip {
    max-width: 800px; margin: 20px auto;
    background: white; padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08); border-radius: 6px;
}
.slip-header {
    border-bottom: 3px double #1f4e78;
    padding-bottom: 18px; margin-bottom: 20px; text-align: center;
}
.slip-header h1 { color: #1f4e78; font-size: 22px; margin-bottom: 4px; }
.slip-header .addr { font-size: 12px; color: #666; }
.slip-header h2 {
    margin-top: 10px; font-size: 16px; color: #333;
    letter-spacing: 2px; text-transform: uppercase;
}
.slip-meta {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 24px; margin-bottom: 24px; font-size: 13px;
}
.slip-meta div { padding: 4px 0; }
.slip-meta .lbl { color: #777; display: inline-block; width: 110px; }
.slip-meta .val { color: #222; font-weight: 600; }
.slip-table {
    width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 13px;
}
.slip-table td { padding: 9px 12px; border-bottom: 1px solid #eee; }
.slip-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.slip-table .section-head td {
    background: #eef2f7; font-weight: bold;
    color: #1f4e78; border-bottom: 2px solid #1f4e78;
}
.slip-table .total-row td {
    font-weight: bold; font-size: 15px;
    background: #1f4e78; color: white; border: none;
}
.slip-footer {
    margin-top: 30px; padding-top: 20px;
    border-top: 1px solid #ddd; display: flex;
    justify-content: space-between; font-size: 12px; color: #666;
}
.slip-footer .sig { text-align: center; }
.slip-footer .sig-line {
    border-top: 1px solid #666; margin-top: 36px;
    padding-top: 4px; min-width: 160px;
}
.print-bar {
    max-width: 800px; margin: 20px auto 0;
    display: flex; gap: 10px; justify-content: center;
}

@media print {
    body { background: white; font-size: 12px; }
    .no-print, .topbar, footer, .print-bar, .actions-cell { display: none !important; }
    .container { max-width: 100%; padding: 0; }
    .card { box-shadow: none; padding: 0; }
    .slip { box-shadow: none; margin: 0; padding: 20px; max-width: 100%; }
    @page { margin: 15mm; }
}

.empty { text-align: center; padding: 40px 20px; color: #888; }
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }

.muted { color: #888; font-size: 12px; }
.deleted-row td { opacity: .5; font-style: italic; }
