:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --surface: #fff;
    --bg: #f1f5f9;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --radius: 10px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.user-chip { color: var(--muted); font-size: 0.9rem; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

h1 { margin: 0 0 0.5rem; font-size: 1.6rem; }
h2 { margin: 0 0 1rem; font-size: 1.15rem; }
.text-muted { color: var(--muted); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(15,23,42,.04);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.form-control {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

.btn {
    display: inline-block;
    padding: 0.55rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.alert-success, .alert-ok { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }

.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.table th, .table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: right;
}
.table th { background: #f8fafc; font-weight: 600; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}
.stat-box .value { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.stat-box .label { font-size: 0.85rem; color: var(--muted); }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef3c7; color: #92400e; }

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}
.actions-row form { display: inline-flex; gap: 0.5rem; align-items: center; margin: 0; }

.context-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.context-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
    color: var(--muted);
}
.context-breadcrumbs li:not(:last-child)::after {
    content: "›";
    margin-inline-start: 0.35rem;
    color: var(--border);
}
.context-breadcrumbs a { color: var(--primary); text-decoration: none; font-weight: 600; }
.context-breadcrumbs span { color: var(--text); font-weight: 600; }
.context-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.table-wrap { overflow-x: auto; }
.badge-delivered-inline { background: #dcfce7; color: #166534; padding: 0.15rem 0.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
.badge-pending-inline { background: #fef3c7; color: #92400e; padding: 0.15rem 0.5rem; border-radius: 6px; font-size: 0.8rem; font-weight: 600; }
