:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --danger: #b91c1c;
    --positive: #15803d;
    --negative: #b91c1c;
    --border: #e5e7eb;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

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

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

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.brand-mark {
    background: var(--primary);
    color: #ffffff;
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.brand-name {
    font-size: 1.1rem;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.page-header h1 {
    margin: 0;
    font-size: 1.9rem;
}

.muted {
    color: var(--muted);
    margin: 4px 0 0;
}

.card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

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

.summary-grid .label {
    color: var(--muted);
    font-size: 0.9rem;
}

.summary-grid .value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-top: 6px;
}

.filters {
    padding: 16px 20px;
}

.filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.95rem;
}

.field label {
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.95rem;
    background: #ffffff;
}

.field textarea {
    resize: vertical;
}

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

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

.btn {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

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

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

.btn.ghost {
    background: transparent;
}

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

.btn.small {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.table-card {
    padding: 0;
}

.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f8fafc;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.table td.actions {
    display: flex;
    gap: 8px;
}

.inline-form {
    display: inline;
}

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

.form-card {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

.profit-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-weight: 600;
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.alert.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.error-text {
    color: var(--danger);
    font-size: 0.85rem;
}

.positive {
    color: var(--positive);
    font-weight: 700;
}

.negative {
    color: var(--negative);
    font-weight: 700;
}

.neutral {
    color: var(--text);
    font-weight: 700;
}

.auth-wrapper {
    max-width: 420px;
    margin: 48px auto;
}

.auth-card h1 {
    margin-top: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 800px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .table th,
    .table td {
        padding: 12px;
    }
}
