:root {
    --bg: #070707;
    --panel: #12100d;
    --panel-2: #1b1710;
    --text: #f8f0df;
    --muted: #b8aa8b;
    --gold: #f0bd3b;
    --gold-2: #ffe39a;
    --border: rgba(240, 189, 59, .22);
    --danger: #dc3545;
    --shadow: 0 22px 70px rgba(0, 0, 0, .42);
}
:root[data-theme="light"] {
    --bg: #f8f5ee;
    --panel: #ffffff;
    --panel-2: #f1e7d4;
    --text: #1e1b15;
    --muted: #766849;
    --border: rgba(130, 91, 10, .18);
    --shadow: 0 18px 45px rgba(58, 43, 10, .12);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-family: Inter, Arial, sans-serif; background: radial-gradient(circle at 50% 0%, rgba(240,189,59,.13), transparent 34%), var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.hamburger { display: none; position: fixed; z-index: 20; top: 14px; left: 14px; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); color: var(--gold); font-size: 24px; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 290px; padding: 22px; background: linear-gradient(180deg, #050505, var(--panel)); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 15; }
:root[data-theme="light"] .sidebar { background: linear-gradient(180deg, #fffaf0, var(--panel)); }
.brand { text-align: center; padding: 8px 0 26px; }
.brand img { max-width: 190px; width: 100%; filter: drop-shadow(0 0 12px rgba(240,189,59,.25)); }
.menu { display: grid; gap: 8px; }
.menu a, .menu summary { cursor: pointer; display: block; padding: 13px 14px; border-radius: 14px; color: var(--muted); transition: .2s; }
.menu a:hover, .menu summary:hover { background: rgba(240,189,59,.10); color: var(--gold-2); }
.menu details a { margin-left: 14px; padding-left: 22px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 16px; }
.theme-switch { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.theme-switch input { display: none; }
.theme-switch span { width: 48px; height: 26px; border-radius: 999px; background: #2a2417; border: 1px solid var(--border); position: relative; }
.theme-switch span:before { content: ''; position: absolute; width: 20px; height: 20px; top: 2px; left: 3px; border-radius: 50%; background: var(--gold); transition: .2s; }
.theme-switch input:checked + span:before { transform: translateX(20px); }
.logout { padding: 13px 14px; border-radius: 14px; background: rgba(220, 53, 69, .12); color: #ff9da8; text-align: center; }
.content { margin-left: 290px; padding: 34px; max-width: 1450px; }
.page-title { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); letter-spacing: -.04em; }
h2 { margin: 0 0 16px; }
p { color: var(--muted); }
.panel, .stat-card, .login-card { background: linear-gradient(180deg, rgba(255,255,255,.04), transparent), var(--panel); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); }
.panel { padding: 22px; margin-bottom: 22px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stat-card { padding: 24px; min-height: 150px; display: grid; align-content: space-between; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { font-size: clamp(30px, 4vw, 46px); color: var(--gold); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--border); border-radius: 14px; padding: 11px 16px; background: var(--panel-2); color: var(--text); cursor: pointer; min-height: 44px; }
.btn.primary { background: linear-gradient(135deg, #bd7f13, var(--gold), #fff1b7); color: #19130a; border: 0; font-weight: 800; }
.btn.danger { background: rgba(220,53,69,.14); color: #ff9da8; }
.btn.small { padding: 8px 12px; min-height: 36px; border-radius: 10px; }
.form { display: grid; gap: 16px; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 700; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 13px; background: rgba(0,0,0,.18); color: var(--text); padding: 11px 12px; outline: none; }
textarea { min-height: 120px; resize: vertical; }
.full { grid-column: 1 / -1; }
.check { align-content: center; grid-template-columns: 20px auto; display: grid; }
.check input { width: 18px; min-height: 18px; }
.filters { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 14px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { color: var(--gold); font-size: 14px; text-transform: uppercase; letter-spacing: .06em; }
.status { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 5px rgba(255,255,255,.04); }
.status.active { background: #20c45a; }
.status.warning { background: #ff9f1c; }
.status.danger { background: #e03131; }
.status.expired { background: #353535; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions form { margin: 0; }
.details { font-size: 18px; }
.amount-box { grid-column: 1 / -1; padding: 18px; border-radius: 18px; background: rgba(240,189,59,.10); border: 1px solid var(--border); font-size: 20px; }
.amount-box strong { color: var(--gold); }
.login-page { display: grid; place-items: center; padding: 22px; }
.login-card { width: min(440px, 100%); padding: 30px; }
.login-logo { display: block; width: 220px; max-width: 100%; margin: 0 auto 20px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.alert.error { background: rgba(220,53,69,.14); color: #ff9da8; }
.mobile-backdrop { display: none; }
@media (max-width: 900px) {
    .hamburger { display: block; }
    .sidebar { transform: translateX(-105%); transition: .25s ease; width: min(86vw, 310px); }
    .sidebar.open { transform: translateX(0); }
    .mobile-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.58); z-index: 10; }
    .content { margin-left: 0; padding: 76px 16px 24px; }
    .page-title { align-items: stretch; flex-direction: column; }
    .cards, .grid-form { grid-template-columns: 1fr; }
    .filters, .inline-form { display: grid; grid-template-columns: 1fr; }
}

/* Ajustements V2 */
.search-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 12px; align-items: end; }
.filter-details summary { cursor: pointer; color: var(--gold); font-weight: 800; padding: 2px 0 16px; }
.filter-details[open] summary { padding-bottom: 16px; }
.mobile-only { display: none; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: rgba(240,189,59,.07); }
.settings-table { min-width: 980px; }
.settings-table input, .settings-table select { min-width: 120px; }
@media (min-width: 901px) {
    .filter-details summary { display: none; }
}
@media (max-width: 900px) {
    h1 { font-size: clamp(24px, 8vw, 32px); letter-spacing: -.03em; }
    h2 { font-size: 20px; }
    .page-title p { margin: 6px 0 0; }
    .panel { padding: 16px; border-radius: 18px; }
    .stat-card { padding: 18px; min-height: 118px; border-radius: 18px; }
    .stat-card strong { font-size: clamp(26px, 8vw, 34px); }
    .cards { gap: 12px; }
    .search-form { grid-template-columns: 1fr; }
    .filter-panel { padding: 14px 16px; }
    .filter-details:not([open]) summary { padding-bottom: 0; }
    .mobile-table-wrap { overflow-x: visible; }
    .responsive-table { min-width: 0; table-layout: fixed; }
    .responsive-table th, .responsive-table td { padding: 12px 8px; font-size: 13px; word-break: break-word; }
    .responsive-table th { font-size: 11px; letter-spacing: .03em; }
    .mobile-only { display: table-cell; }
    .desktop-only-cell { display: none; }
    .clients-table th:nth-child(1), .clients-table td:nth-child(1) { width: 52px; }
    .clients-table th:nth-child(4), .clients-table td:nth-child(4) { width: 94px; }
    .subscriptions-table th:nth-child(1), .subscriptions-table td:nth-child(1) { width: 44px; text-align: center; }
    .subscriptions-table th:nth-child(2), .subscriptions-table td:nth-child(2) { width: 38%; }
    .status { width: 13px; height: 13px; }
}
