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

body {
    font-family: system-ui, sans-serif;
    font-size: 15px;
    color: #1a1a2e;
    background: #f4f6f9;
    min-height: 100vh;
}

/* ── Nav ── */
nav {
    background: #1a1a2e;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

nav .brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: auto;
    padding: 1rem 0;
    text-decoration: none;
}

nav a {
    color: #c8d0e0;
    text-decoration: none;
    padding: 1rem 0.85rem;
    display: inline-block;
    transition: color 0.15s, background 0.15s;
    border-radius: 4px 4px 0 0;
}

nav a:hover, nav a.active { color: #fff; background: rgba(255,255,255,0.1); }

/* ── Main ── */
main {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 { font-size: 1.6rem; margin-bottom: 1.25rem; color: #1a1a2e; }
h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: #fdecea; border-left: 4px solid #e53935; color: #b71c1c; }
.alert-info  { background: #e3f2fd; border-left: 4px solid #1e88e5; color: #0d47a1; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

thead { background: #1a1a2e; color: #fff; }
thead th { padding: 0.75rem 1rem; text-align: left; font-weight: 600; font-size: 0.85rem; letter-spacing: 0.04em; }

tbody tr { border-bottom: 1px solid #eef0f4; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8f9fc; }
tbody td { padding: 0.7rem 1rem; }

tfoot { background: #f4f6f9; font-weight: 700; }
tfoot td { padding: 0.7rem 1rem; }

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.88; }
.btn-primary   { background: #1a1a2e; color: #fff; }
.btn-secondary { background: #e2e6ea; color: #1a1a2e; }
.btn-danger    { background: #e53935; color: #fff; }
.btn-success   { background: #2e7d32; color: #fff; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

.actions { display: flex; gap: 0.4rem; align-items: center; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }

/* ── Form ── */
.form-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    max-width: 520px;
}

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.875rem; }
.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus { outline: none; border-color: #1a1a2e; }
.errorlist { color: #e53935; font-size: 0.8rem; margin-top: 0.25rem; list-style: none; }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

/* ── Invoice row builder ── */
#rows-table { margin-bottom: 1rem; }
#rows-table select { min-width: 220px; }
#rows-table input[type="number"] { width: 80px; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    justify-content: center;
}
.pagination a, .pagination span {
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    font-size: 0.875rem;
    text-decoration: none;
}
.pagination a { background: #1a1a2e; color: #fff; }
.pagination a:hover { background: #333560; }
.pagination span { background: #e2e6ea; color: #555; }

/* ── Invoice detail summary ── */
.summary-box {
    display: flex;
    gap: 1.5rem;
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.summary-box .stat { display: flex; flex-direction: column; gap: 0.2rem; }
.summary-box .stat-label { font-size: 0.78rem; color: #666; text-transform: uppercase; letter-spacing: 0.05em; }
.summary-box .stat-value { font-size: 1.4rem; font-weight: 700; color: #1a1a2e; }

/* ── Confirm delete ── */
.confirm-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    max-width: 480px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.confirm-card p { margin-bottom: 1rem; line-height: 1.6; }
