:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --ink: #1e2430;
    --muted: #667085;
    --primary: #3157d5;
    --success: #0f9d58;
    --warning: #d97706;
    --danger: #c62828;
    --border: #dde3ee;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

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

.topbar {
    background: #111827;
    color: #fff;
}

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

.topbar nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar a {
    color: #fff;
    text-decoration: none;
}

h1, h2, h3 {
    margin-top: 0;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(17, 24, 39, 0.05);
}

.grid {
    display: grid;
    gap: 16px;
}

.stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 20px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: bold;
}

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

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

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

.btn-secondary {
    background: #e9eefc;
    color: #1d3d9f;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

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

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 600;
}

input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.flash-list {
    list-style: none;
    padding: 0;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 10px;
}

.flash-success {
    background: #e7f7ef;
    color: #0f6a3d;
}

.flash-error {
    background: #fdeaea;
    color: #8f1f1f;
}

.flash-warning {
    background: #fff4e5;
    color: #9a5c00;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.badge-active {
    background: #e7f7ef;
    color: #0f6a3d;
}

.badge-removed {
    background: #fdeaea;
    color: #8f1f1f;
}

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

.photo-grid img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.photo-thumb-btn {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.photo-thumb {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.photo-thumb-btn:hover .photo-thumb,
.photo-thumb-btn:focus-visible .photo-thumb {
    transform: scale(1.02);
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.18);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    width: min(96vw, 1200px);
    max-height: 94vh;
    padding: 12px;
    border-radius: 14px;
    background: #0b1220;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.lightbox-close {
    display: inline-block;
    margin-bottom: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
}

#lightbox-image {
    display: block;
    width: 100%;
    max-height: calc(94vh - 64px);
    object-fit: contain;
    border-radius: 10px;
}

.inline-form {
    display: inline;
}

.calc-panel {
    background: #f8faff;
    border: 1px solid #cdd8fb;
    border-radius: 12px;
    padding: 14px;
}

.calc-panel h3 {
    margin-bottom: 6px;
}

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