:root {
    color-scheme: light;
    font-family: "Segoe UI", Tahoma, sans-serif;
    color: #172033;
    background: #f3f6fb;
    --navy: #12223f;
    --blue: #2166d1;
    --line: #dde4ef;
    --muted: #68748a;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; background: #f3f6fb; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 18px;
    color: #fff;
    background: linear-gradient(180deg, #142747 0%, #0d1930 100%);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 30px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; font-weight: 800; background: #4387f5; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 3px; color: #aebbd0; }

.menu-item { display: flex; align-items: center; width: 100%; gap: 12px; padding: 13px 14px; border: 0; border-radius: 11px; color: #c9d4e5; background: transparent; text-align: left; text-decoration: none; }
.menu-item.active, .menu-item:hover { color: #fff; background: rgba(81, 139, 231, .2); }
.menu-icon { font-size: 21px; }
.menu-heading { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 13px 14px 7px; color: #fff; font-weight: 700; }
.menu-item.submenu { padding-left: 48px; font-size: 14px; }

.content { min-width: 0; padding: 38px clamp(20px, 4vw, 56px); }
.topbar { display: flex; justify-content: space-between; min-height: 36px; margin-bottom: 22px; }
.user-panel { display: flex; align-items: center; gap: 9px; color: var(--navy); }
.user-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #4f8deb; background: #e7f0ff; font-size: 10px; }
.link-button { padding: 5px 8px; border: 0; color: var(--blue); background: transparent; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1, h2 { margin: 0; color: var(--navy); }
h1 { font-size: clamp(26px, 3vw, 36px); }
.subtitle { margin: 8px 0 0; color: var(--muted); }

button { font: inherit; cursor: pointer; }
.primary-button, .secondary-button, .small-button { border: 0; border-radius: 9px; }
.primary-button { padding: 11px 17px; color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(33,102,209,.18); }
.secondary-button { height: 42px; padding: 0 22px; color: #fff; background: var(--navy); }
.small-button { padding: 7px 13px; color: #fff; background: var(--blue); }
.full { width: 100%; margin-top: 8px; }
.refresh-button, .image-button { border: 0; border-radius: 9px; color: #fff; background: var(--blue); }
.refresh-button { padding: 11px 17px; box-shadow: 0 7px 18px rgba(33, 102, 209, .18); }
.refresh-button:disabled { opacity: .65; cursor: wait; }

.filter-card {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(25, 45, 78, .05);
}
.date-field { display: grid; gap: 7px; min-width: 190px; color: #536078; font-size: 13px; font-weight: 700; }
.date-field input { height: 42px; padding: 0 12px; border: 1px solid #ccd5e3; border-radius: 9px; color: var(--navy); background: #fff; font: inherit; }
.date-field input:focus { border-color: var(--blue); outline: 3px solid rgba(33, 102, 209, .12); }
.filter-button { height: 42px; padding: 0 22px; border: 0; border-radius: 9px; color: #fff; background: var(--navy); }
.filter-error { align-self: center; color: #b42318; font-size: 13px; }
.form-field { display: grid; gap: 7px; color: #536078; font-size: 13px; font-weight: 700; }
.form-field input, .form-field select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #ccd5e3; border-radius: 9px; color: var(--navy); background: #fff; font: inherit; }
.form-field input:focus, .form-field select:focus { border-color: var(--blue); outline: 3px solid rgba(33,102,209,.12); }
.form-field input:disabled { color: #68748a; background: #eef2f7; }
.form-message { min-height: 22px; margin: 14px 0 4px; font-size: 13px; }
.form-message.error { color: #b42318; }.form-message.success { color: #067647; }

.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 12px 30px rgba(25, 45, 78, .06); }
.status-message { padding: 14px 20px; color: var(--muted); border-bottom: 1px solid var(--line); }
.status-message.error { color: #b42318; background: #fff4f2; }
.status-message:empty { display: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 15px 18px; border-bottom: 1px solid #e9edf4; text-align: left; }
th { color: #536078; background: #f8faff; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 14px; }
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child td { border-bottom: 0; }
.action-column { text-align: center; }
.image-button { padding: 7px 13px; font-size: 13px; }
.empty-cell { padding: 48px 20px; color: var(--muted); text-align: center; }

.image-dialog { width: min(900px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 25px 70px rgba(0, 0, 0, .3); }
.image-dialog::backdrop { background: rgba(8, 17, 31, .72); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 20px; }
.close-button { width: 38px; height: 38px; border: 0; border-radius: 50%; color: #526078; background: #edf1f7; font-size: 26px; line-height: 1; }
.image-stage { display: grid; place-items: center; min-height: 300px; max-height: 75vh; padding: 20px; background: #eef2f7; }
.image-stage img { display: block; max-width: 100%; max-height: calc(75vh - 40px); object-fit: contain; }

@media (max-width: 760px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; height: auto; padding: 16px; }
    .brand { padding-bottom: 16px; }
    .content { padding: 24px 14px; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .refresh-button { width: 100%; }
    .filter-card { align-items: stretch; flex-direction: column; }
    .date-field { width: 100%; }
    .filter-button { width: 100%; }
}
