:root {
    --primary: #1e5a3c;
    --primary-dark: #164529;
    --primary-light: #e8f3ee;
    --text: #232323;
    --muted: #6b7280;
    --border: #e2e5e2;
    --bg: #f6f8f6;
    --danger: #c0392b;
    --success: #1e5a3c;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Top bar */
.topbar {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}
.topbar nav a {
    color: #dfe9e4;
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.95rem;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}
.topbar nav a:hover, .topbar nav a.active {
    color: #fff;
    border-bottom-color: #fff;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.page-head h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
}
.muted { color: var(--muted); margin: 0 0 20px; }

.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}
.form-group { display: flex; flex-direction: column; }
.form-group-wide { grid-column: 1 / -1; }
label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
}
.req { color: var(--danger); }
.optional { font-weight: 400; color: var(--muted); font-size: 0.8rem; }

input[type=text], input[type=number], input[type=email], input[type=date], input[type=file], select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: var(--text);
    width: 100%;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.logo-preview { margin-top: 10px; }
.logo-preview img {
    max-width: 100px;
    max-height: 100px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    background: #fff;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-light); }
.btn-link { background: none; color: var(--muted); padding: 10px 6px; }

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.alert-success { background: #e8f3ee; color: var(--primary-dark); border: 1px solid #bfe0cd; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c2; }
.alert a { color: inherit; font-weight: 600; }

/* Toolbar / list */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 24px;
}
.search-form { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; flex: 1 1 480px; min-width: 0; }
.search-form .search-input { flex: 1 1 140px; min-width: 100px; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.filter-group input[type="date"] { min-width: 0; }
.search-form button, .search-form a.btn { flex-shrink: 0; }
.filter-label { font-size: 12px; color: var(--muted); white-space: nowrap; }

.toolbar-actions { display: flex; gap: 10px; }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table th {
    background: #fafbfa;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.table tr:hover td { background: #fafcfb; }
.table .empty { text-align: center; color: var(--muted); padding: 30px; }

.badge {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.actions a {
    text-decoration: none;
    font-size: 1.1rem;
    margin-right: 10px;
}

.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 20px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 4px;
}
.pagination-info {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}
.pagination a.disabled {
    pointer-events: none;
    opacity: 0.4;
}

.result-card { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
@media (max-width: 640px) {
    .result-card { flex-direction: column; align-items: stretch; }
    .result-card .btn { width: 100%; }
}

.format-choice { display: flex; gap: 16px; margin-bottom: 12px; font-size: 0.85rem; font-weight: 400; }
.format-choice label { display: flex; align-items: center; gap: 6px; }
@media (max-width: 640px) {
    .format-choice { flex-direction: column; gap: 8px; }
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .table th, .table td { white-space: normal; }

    .toolbar { flex-direction: column; align-items: stretch; }
    .search-form { flex-direction: column; flex: 0 0 auto; align-items: stretch; }
    .search-form .search-input { flex: 0 0 auto; width: 100%; }
    .filter-group { width: 100%; }
    .filter-group input[type="date"] { flex: 1; width: 100%; }
    .search-form button, .search-form a.btn { width: 100%; text-align: center; flex-shrink: 1; }
    .toolbar-actions { flex-direction: column; align-items: stretch; }
    .toolbar-actions .btn { width: 100%; text-align: center; }
}
