:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --green: #16a34a;
    --teal: #0d9488;
    --orange: #ea580c;
    --purple: #7c3aed;
    --danger: #dc2626;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Top navigation ===== */
.topnav {
    background: #0f172a;
    color: #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 0 24px;
    height: 54px;
}
.brand {
    color: #fff;
    text-decoration: none;
    font-size: 17px;
    letter-spacing: .2px;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.brand strong { color: #60a5fa; }
.brand-dot {
    width: 10px; height: 10px; border-radius: 3px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    display: inline-block;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 500;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-links a.active { color: #fff; background: rgba(96,165,250,.18); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { color: #94a3b8; font-size: 13px; }
.inline-form { display: inline; }

/* ===== Layout ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 24px; }
.footer {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    padding: 28px 0 34px;
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ===== Panels / cards ===== */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}
.panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 18px;
}
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
}
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.accent-green { border-left-color: var(--green); }
.accent-blue { border-left-color: var(--primary); }
.accent-purple { border-left-color: var(--purple); }
.accent-orange { border-left-color: var(--orange); }
.accent-teal { border-left-color: var(--teal); }

/* ===== Tables ===== */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--muted);
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    white-space: nowrap;
}
.table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}
.table-hover tbody tr:hover { background: #f8fafc; }
.table.kv th {
    background: transparent;
    width: 38%;
    font-size: 12px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    border-bottom: 1px solid #f1f5f9;
    white-space: normal;
}
.co-name { font-weight: 600; text-decoration: none; color: var(--primary); }
.co-name:hover { text-decoration: underline; }

/* ===== Badges ===== */
.badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}
.badge-gray { background: #f1f5f9; color: var(--muted); }
.badge-green { background: #dcfce7; color: #166534; }
.badge-teal { background: #ccfbf1; color: #115e59; }

/* ===== Filter bar ===== */
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 16px;
}
.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-row + .filter-row { margin-top: 10px; }
.input-search {
    flex: 1 1 340px;
    min-width: 240px;
}
.input-sm { width: 170px; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], select, textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    white-space: nowrap;
}
.check-label input { accent-color: var(--primary); }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background .12s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: #f8fafc; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: #eff6ff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-xs { padding: 3px 9px; font-size: 11.5px; }
.btn-block { width: 100%; }

/* ===== Alerts ===== */
.alert {
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13.5px;
}
.alert ul { margin-left: 18px; }
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }

/* ===== Pagination (Laravel default markup) ===== */
.pagination-wrap { margin-top: 16px; }
nav[role="navigation"] { display: flex; justify-content: center; }
.pagination {
    display: inline-flex;
    list-style: none;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.pagination li { display: inline-block; }
.pagination li a, .pagination li span {
    display: block;
    padding: 6px 12px;
    border-radius: 7px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.pagination li.active span {
    background: var(--primary);
    color: #fff;
}
.pagination li.disabled span { color: #cbd5e1; }
.pagination li a:hover { background: #f1f5f9; }
.pagination li:not(:last-child) { margin-right: 2px; }

/* ===== Login ===== */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.login-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    padding: 36px;
    width: 100%;
    max-width: 400px;
}
.login-logo {
    font-size: 22px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-sub { color: var(--muted); margin-bottom: 22px; font-size: 13.5px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
.login-card input[type="email"], .login-card input[type="password"] {
    width: 100%;
    padding: 10px 14px;
}
.login-card .btn { margin-top: 20px; }
.login-card .check-label { margin-top: 12px; }

/* ===== Forms ===== */
.edit-form label { display: block; font-size: 12.5px; font-weight: 600; margin: 12px 0 4px; color: var(--text); }
.edit-form input, .edit-form textarea, .edit-form select { width: 100%; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

@media (max-width: 720px) {
    .nav-inner { gap: 12px; padding: 0 12px; }
    .nav-links { overflow-x: auto; }
    .container { padding: 14px; }
    .grid-2 { grid-template-columns: 1fr; }
}
