@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

:root {
    --bg: #0b1220;
    --bg-soft: #101b30;
    --card: #16243e;
    --card-2: #1a2e4d;
    --line: #27446d;
    --text: #f2f7ff;
    --muted: #9ab0d1;
    --primary: #24a9ff;
    --primary-strong: #1b85ca;
    --danger: #f35d5d;
    --success: #43c98d;
    --warning: #e8b347;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'DM Sans', 'Trebuchet MS', sans-serif;
    background:
        radial-gradient(900px 460px at 80% -10%, rgba(36, 169, 255, 0.2), transparent 60%),
        radial-gradient(700px 380px at 0% 0%, rgba(67, 201, 141, 0.12), transparent 55%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: #8ec7ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    background: rgba(8, 14, 25, 0.86);
}

.brand a {
    color: #d7ebff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-decoration: none;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.nav-links a {
    padding: 7px 11px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 0.92rem;
    text-decoration: none;
}

.nav-links a:hover {
    border-color: rgba(142, 199, 255, 0.35);
    background: rgba(142, 199, 255, 0.08);
}

.danger-link:hover {
    border-color: rgba(243, 93, 93, 0.5) !important;
    background: rgba(243, 93, 93, 0.14) !important;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 16px 44px;
}

.page-head h1 {
    margin: 0 0 6px;
    font-size: 1.45rem;
}

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

.center {
    text-align: center;
}

.flash {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    line-height: 1.35;
}

.flash-success {
    background: rgba(67, 201, 141, 0.14);
    border-color: rgba(67, 201, 141, 0.35);
}

.flash-error {
    background: rgba(243, 93, 93, 0.14);
    border-color: rgba(243, 93, 93, 0.35);
}

.flash-warning {
    background: rgba(232, 179, 71, 0.14);
    border-color: rgba(232, 179, 71, 0.35);
}

.content-card {
    background: linear-gradient(180deg, rgba(26, 46, 77, 0.7), rgba(22, 36, 62, 0.76));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.content-card h2 {
    margin: 0 0 14px;
    font-size: 1.1rem;
}

.narrow {
    max-width: 560px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: linear-gradient(180deg, rgba(22, 36, 62, 0.95), rgba(17, 27, 48, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 14px;
}

.stat-card h3 {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-card p {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.stat-card.highlight {
    border-color: rgba(36, 169, 255, 0.45);
}

.diagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.flow-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.flow-node {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(11, 18, 32, 0.55);
    font-size: 0.92rem;
}

.flow-node.accent {
    border-color: rgba(67, 201, 141, 0.6);
    background: rgba(67, 201, 141, 0.12);
}

.flow-arrow {
    color: var(--muted);
    font-weight: 700;
}

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

.mini-metrics strong {
    font-size: 0.85rem;
    color: var(--muted);
}

.mini-metrics p {
    margin: 6px 0 0;
    font-size: 1rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.bar-stack {
    display: grid;
    gap: 10px;
}

.bar-row {
    display: grid;
    gap: 6px;
}

.bar-label {
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.4px;
}

.bar-track {
    display: grid;
    gap: 6px;
}

.bar {
    min-height: 28px;
    border-radius: 999px;
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
}

.bar span {
    font-size: 0.77rem;
}

.bar.received {
    background: linear-gradient(90deg, #2a5ea7, #1f7fd0);
}

.bar.profit {
    background: linear-gradient(90deg, #1f8a5c, #2db173);
}

.grid-form {
    display: grid;
    gap: 12px;
}

.grid-form label {
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
    color: #d7e8ff;
}

input,
select,
button {
    font-family: inherit;
}

input,
select {
    background: rgba(11, 18, 32, 0.78);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(36, 169, 255, 0.2);
}

input[readonly] {
    opacity: 0.9;
    background: rgba(38, 56, 86, 0.6);
}

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

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 0.92rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary), var(--primary-strong));
    color: #041320;
    font-weight: 700;
}

.btn-primary:hover {
    filter: brightness(1.06);
    text-decoration: none;
}

.btn-secondary {
    background: rgba(142, 199, 255, 0.12);
    color: #d9ecff;
    border: 1px solid rgba(142, 199, 255, 0.28);
}

.btn-secondary:hover {
    background: rgba(142, 199, 255, 0.2);
    text-decoration: none;
}

.btn-danger {
    background: rgba(243, 93, 93, 0.16);
    color: #ffdede;
    border: 1px solid rgba(243, 93, 93, 0.36);
}

.btn-danger:hover {
    background: rgba(243, 93, 93, 0.24);
    text-decoration: none;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.82rem;
}

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

table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 11px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
}

th {
    color: #c7ddff;
    font-weight: 600;
}

.table-actions {
    white-space: nowrap;
}

.inline-form {
    display: inline-block;
}

.daily-total-row td {
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.totals-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-bottom: 10px;
    color: #e3f1ff;
    font-size: 0.95rem;
}

.diary-day {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(10, 18, 32, 0.35);
}

.diary-day h3 {
    margin: 0 0 10px;
    letter-spacing: 0.5px;
}

.login-wrap {
    min-height: calc(100vh - 100px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-card {
    width: min(460px, 100%);
    background: linear-gradient(180deg, rgba(26, 46, 77, 0.85), rgba(16, 27, 48, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 24px;
}

.login-card h1 {
    margin: 0 0 8px;
}

code {
    background: rgba(11, 18, 32, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    padding: 2px 6px;
    font-family: Consolas, monospace;
    font-size: 0.83rem;
}

@media (max-width: 720px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links a {
        font-size: 0.88rem;
    }

    .container {
        padding-top: 16px;
    }

    .content-card {
        padding: 14px;
    }

    table {
        min-width: 560px;
    }
}

