:root {
    --bg: #f5f5f7;
    --card: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --border: #e3e3e6;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --green: #34c759;
    --red: #ff3b30;
    --orange: #ff9f0a;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.10);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
        "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
}

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

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--border);
    padding: 26px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 10px 22px;
    font-weight: 600;
    font-size: 17px;
    letter-spacing: -0.2px;
}
.brand .logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: linear-gradient(135deg, #0071e3, #42a5ff);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 17px;
}
.brand small { display: block; font-weight: 400; color: var(--text-secondary); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--text); font-weight: 500; font-size: 14.5px;
    transition: background 0.15s ease;
}
.nav a:hover { background: rgba(0, 0, 0, 0.04); }
.nav a.active { background: var(--accent); color: #fff; }
.nav a .ico { width: 18px; text-align: center; opacity: 0.9; }

.sidebar .spacer { flex: 1; }
.logout-form button {
    width: 100%; text-align: left;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    background: none; border: none; cursor: pointer;
    color: var(--red); font-weight: 500; font-size: 14.5px;
    font-family: inherit;
}
.logout-form button:hover { background: rgba(255, 59, 48, 0.08); }

.main { flex: 1; padding: 36px 44px; max-width: 1280px; }
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.5px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-secondary); }

/* ---------- Cards ---------- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.02);
}
.card-pad { padding: 22px 24px; }

.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat {
    background: var(--card); border-radius: var(--radius);
    padding: 20px 22px; box-shadow: var(--shadow);
}
.stat .num { font-size: 32px; font-weight: 600; letter-spacing: -0.5px; }
.stat .label { color: var(--text-secondary); font-size: 13.5px; margin-top: 2px; }
.stat.green .num { color: var(--green); }
.stat.orange .num { color: var(--orange); }
.stat.red .num { color: var(--red); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; }
thead th {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--text-secondary); font-weight: 600;
    border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
td .muted { color: var(--text-secondary); font-size: 13px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 100px;
    font-size: 12.5px; font-weight: 600;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.pending  { background: rgba(255,159,10,0.12); color: #b46a00; }
.badge.approved { background: rgba(52,199,89,0.13);  color: #1a7e34; }
.badge.rejected { background: rgba(255,59,48,0.11);  color: #c4271d; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 980px;
    font-size: 14.5px; font-weight: 500; font-family: inherit;
    cursor: pointer; border: 1px solid transparent; transition: all 0.15s; line-height: 1;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.04); }
.btn-red { background: #fff; color: var(--red); border-color: rgba(255,59,48,0.3); }
.btn-red:hover { background: rgba(255,59,48,0.06); }
.btn-light { background: rgba(0,0,0,0.05); color: var(--text); }
.btn-light:hover { background: rgba(0,0,0,0.08); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

/* ---------- Forms / filters ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
    padding: 7px 15px; border-radius: 980px; font-size: 13.5px; font-weight: 500;
    background: var(--card); color: var(--text); border: 1px solid var(--border);
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.search input {
    padding: 9px 16px; border-radius: 980px; border: 1px solid var(--border);
    font-size: 14px; font-family: inherit; min-width: 230px; background: #fff;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,113,227,0.15); }

/* ---------- Submissions gallery ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.work {
    background: var(--card); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
    display: flex; flex-direction: column;
}
.work:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.work .thumb {
    aspect-ratio: 1/1; background: #f0f0f2 center/cover no-repeat; display: block;
}
.work .meta { padding: 13px 15px; }
.work .meta .name { font-weight: 600; font-size: 14.5px; }
.work .meta .sub { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.work .meta .row { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }

/* ---------- Detail ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.detail .photo-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.detail .photo-box img { width: 100%; border-radius: var(--radius-sm); display: block; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-secondary); }
.kv .v { font-weight: 500; text-align: right; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Alerts ---------- */
.alert {
    padding: 13px 18px; border-radius: var(--radius-sm); margin-bottom: 20px;
    font-weight: 500; background: rgba(52,199,89,0.12); color: #1a7e34;
    border: 1px solid rgba(52,199,89,0.25);
}

.empty { text-align: center; padding: 70px 20px; color: var(--text-secondary); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; margin: 22px 0 0; justify-content: center; flex-wrap: wrap; }
.pagination a, .pagination span {
    display: inline-flex; min-width: 36px; height: 36px; align-items: center; justify-content: center;
    padding: 0 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--border);
    color: var(--text); font-size: 14px;
}
.pagination .active span { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .disabled span { opacity: 0.4; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: radial-gradient(1200px 600px at 50% -10%, #e8f0ff 0%, var(--bg) 55%); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.10); padding: 40px 36px; text-align: center; }
.login-card .logo { width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 18px;
    background: linear-gradient(135deg, #0071e3, #42a5ff); display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 26px; }
.login-card h1 { font-size: 23px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.4px; }
.login-card p.sub { color: var(--text-secondary); margin: 0 0 26px; font-size: 14px; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
.field input {
    width: 100%; padding: 12px 15px; border-radius: 12px; border: 1px solid var(--border);
    font-size: 15px; font-family: inherit; background: #fcfcfd;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,0.14); background: #fff; }
.login-card .btn { width: 100%; padding: 13px; margin-top: 6px; font-size: 15.5px; }
.form-error { background: rgba(255,59,48,0.09); color: #c4271d; border-radius: 12px;
    padding: 10px 14px; font-size: 13.5px; margin-bottom: 16px; text-align: left; }

@media (max-width: 820px) {
    .sidebar { display: none; }
    .main { padding: 22px 18px; }
    .detail { grid-template-columns: 1fr; }
}
