:root {
  --app-bg: #090b0e;
  --app-panel: rgba(23, 23, 22, .76);
  --app-panel-strong: rgba(29, 29, 28, .9);
  --app-text: #f7f3eb;
  --app-muted: #c6c0b6;
  --app-gold: #d9c39b;
  --app-line: rgba(225, 196, 137, .22);
}

.dashboard-page {
  min-height: 100vh;
  margin: 0;
  color: var(--app-text);
  background: #090d12;
}

.dashboard-page::before {
  content: "";
  position: fixed;
  inset: -8%;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 46% at 26% 18%, rgba(189,142,70,.52), transparent 72%),
    radial-gradient(ellipse 30% 42% at 73% 22%, rgba(83,117,151,.46), transparent 70%),
    radial-gradient(ellipse 28% 38% at 58% 76%, rgba(93,128,113,.34), transparent 72%),
    radial-gradient(ellipse 34% 34% at 92% 88%, rgba(151,91,69,.31), transparent 74%),
    linear-gradient(135deg, #11161c 0%, #090d12 48%, #111014 100%);
}

.glass-panel {
  border: 1px solid rgba(255,255,255,.13);
  background: linear-gradient(145deg, rgba(255,255,255,.09), rgba(255,255,255,.025)), var(--app-panel);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.11), 0 28px 70px rgba(0,0,0,.3);
  backdrop-filter: blur(28px) saturate(125%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.app-sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 36px);
  min-height: 580px;
  padding: 20px 14px 14px;
  overflow: hidden;
  border-radius: 28px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 10px;
  color: var(--app-text);
  text-decoration: none;
}

.side-brand img { width: 158px; height: 54px; object-fit: contain; object-position: left center; }
.side-brand > span { padding-left: 10px; border-left: 1px solid rgba(217,195,155,.45); color: var(--app-gold); font-size: 9px; font-weight: 750; letter-spacing: .2em; }
.side-rule { height: 1px; margin: 15px 8px 17px; background: linear-gradient(90deg, transparent, var(--app-line), transparent); }
.side-section { margin: 0 12px 8px; color: #9e988e; font-size: 9px; font-weight: 750; letter-spacing: .16em; text-transform: uppercase; }
.app-sidebar nav { display: grid; gap: 4px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 15px;
  color: #d4cfc6;
  background: transparent;
  text-decoration: none;
  font-size: 13px;
  font-weight: 590;
  cursor: pointer;
  transition: .18s ease;
}

.side-link svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.side-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-link.is-active { color: #f5e6c5; border-color: rgba(214,177,103,.28); background: linear-gradient(90deg, rgba(207,164,83,.16), rgba(255,255,255,.04)); box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.side-account { display: grid; grid-template-columns: 40px minmax(0,1fr); align-items: center; gap: 10px; margin: auto 3px 6px; padding: 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 17px; background: rgba(0,0,0,.18); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(224,187,112,.34); border-radius: 13px; color: #241b0d; background: linear-gradient(145deg, #f0dba9, #bd934e); font-size: 14px; font-weight: 800; }
.account-copy, .user-cell > span:last-child { display: grid; min-width: 0; gap: 2px; }
.account-copy b, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy b { color: var(--app-text); font-size: 12px; }
.account-copy small { color: #aaa49b; font-size: 9px; }
.app-sidebar form { margin: 0; }
.side-logout { color: #aaa49b; border: 0; }

.app-main { width: min(980px, 100%); margin: 0 auto; padding: 8px clamp(6px, 1.5vw, 20px) 32px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 76px; margin-bottom: 14px; }
.page-header p, .panel-kicker, .panel-heading p { margin: 0 0 7px; color: var(--app-gold); font-size: 10px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.page-header h1 { margin: 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: -.04em; }
.role-pill { padding: 7px 11px; border: 1px solid var(--app-line); border-radius: 999px; color: #e9d7b1; background: rgba(206,165,83,.1); font-size: 9px; font-weight: 650; }
.notice, .form-error { margin-bottom: 14px; padding: 12px 15px; border-radius: 14px; font-size: 12px; }
.notice { color: #dff4df; border: 1px solid rgba(103,190,109,.25); background: rgba(61,133,67,.14); }
.form-error, .login-error { color: #ffd8d2; border: 1px solid rgba(218,103,84,.3); background: rgba(144,53,42,.18); }

.welcome-panel { min-height: 0; padding: clamp(26px, 4vw, 40px); border-radius: 24px; }
.welcome-panel h2 { margin: 0; font-size: clamp(32px, 5vw, 48px); letter-spacing: -.055em; }
.welcome-panel > p:not(.panel-kicker) { max-width: 560px; margin: 12px 0 20px; color: var(--app-muted); font-size: 14px; line-height: 1.5; }
.primary-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 1px solid rgba(255,255,255,.42); border-radius: 13px; color: #21190e; background: linear-gradient(135deg, #f0e2c3, #c6a86f); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 10px 24px rgba(166,128,61,.14); text-decoration: none; font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.primary-action:hover { filter: brightness(1.06); transform: translateY(-1px); }
.primary-action svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.primary-action.compact { min-height: 42px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-top: 10px; }
.summary-card { display: grid; gap: 7px; padding: 16px 18px; border-radius: 18px; }
.summary-card span { color: #aaa49b; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.summary-card strong { font-size: 14px; }
.status-ok { color: #a9dfa9; }

.content-panel, .form-card { padding: clamp(18px, 2.5vw, 26px); border-radius: 22px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.panel-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 8px 10px; color: #a6a097; font-size: 8px; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
td { padding: 10px; border-top: 1px solid rgba(255,255,255,.075); color: #ded9cf; font-size: 11px; }
.user-cell { display: grid; grid-template-columns: 32px minmax(130px,1fr); align-items: center; gap: 9px; }
.user-cell .avatar { width: 32px; height: 32px; border-radius: 10px; font-size: 12px; }
.user-cell b { color: #f4f0e8; font-size: 12px; }
.user-cell small { color: #aaa49b; font-size: 10px; }
.role-badge { display: inline-flex; padding: 6px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; color: #ddd7cc; background: rgba(255,255,255,.055); font-size: 8px; }
.role-platform_admin { color: #f2deb4; border-color: rgba(220,177,93,.34); background: rgba(206,160,68,.13); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 160px; }
.row-actions form { margin: 0; }
.table-action { display: inline-flex; padding: 7px 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; color: #d8d2c8; background: rgba(255,255,255,.04); text-decoration: none; font: inherit; font-size: 9px; cursor: pointer; }
.table-action.danger { color: #e9b8b0; }
.protected-label { color: #9f998f; font-size: 9px; }
.back-link { display: inline-flex; margin-bottom: 20px; color: #c9b88f; text-decoration: none; font-size: 11px; }
.form-card { max-width: 620px; }
.data-form { display: grid; gap: 15px; }
.data-form label { display: grid; gap: 8px; color: #e4ded4; font-size: 11px; font-weight: 650; }
.field-hint { color: #9f998f; font-size: 9px; font-weight: 450; }
.data-form input, .data-form select { width: 100%; height: 44px; padding: 0 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 12px; outline: 0; color: #f6f2e9; background: rgba(0,0,0,.3); font: inherit; }
.data-form input:focus, .data-form select:focus { border-color: rgba(217,195,155,.62); box-shadow: 0 0 0 4px rgba(217,195,155,.07); }
.data-form select option { color: #1e1b16; }
.form-submit { width: 100%; margin-top: 6px; }
.readonly-badge { padding: 7px 10px; border: 1px solid rgba(138,201,151,.28); border-radius: 999px; color: #b9dfc0; background: rgba(71,137,85,.12); font-size: 9px; font-weight: 700; letter-spacing: .04em; }
.materials-state { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 15px; align-items: start; padding: 20px; border: 1px solid rgba(225,196,137,.16); border-radius: 17px; background: rgba(4,7,10,.22); }
.materials-state-icon { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(217,195,155,.34); border-radius: 13px; color: #e7ce9b; background: rgba(200,168,107,.09); font-weight: 800; }
.materials-state h3 { margin: 1px 0 7px; color: #f1ece3; font-size: 15px; }
.materials-state p { max-width: 620px; margin: 0 0 10px; color: var(--app-muted); font-size: 12px; line-height: 1.55; }
.materials-state small { color: var(--app-gold); font-size: 9px; letter-spacing: .1em; }
.simple-error { display: grid; place-content: center; min-height: 100vh; text-align: center; }
.login-error { position: relative; z-index: 2; margin: -16px 0 18px; padding: 10px 12px; border-radius: 12px; font-size: 11px; }
.password-toggle { position: absolute; right: 10px; z-index: 2; padding: 7px 9px; border: 0; border-radius: 9px; color: #d9c39b; background: rgba(217,195,155,.09); font: inherit; font-size: 10px; cursor: pointer; }
.password-toggle:hover { background: rgba(217,195,155,.16); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 86px minmax(0,1fr); gap: 12px; padding: 12px; }
  .app-sidebar { top: 12px; height: calc(100vh - 24px); padding: 15px 9px 10px; border-radius: 23px; }
  .side-brand { justify-content: center; padding: 0; }
  .side-brand img { width: 55px; object-fit: cover; object-position: left; }
  .side-brand > span, .side-section, .side-link span, .account-copy { display: none; }
  .side-link { justify-content: center; padding: 0; }
  .side-account { display: flex; justify-content: center; padding: 9px; }
  .page-header { min-height: 78px; }
}

@media (max-width: 620px) {
  .app-shell { display: block; padding: 10px; }
  .app-sidebar { position: fixed; z-index: 30; top: auto; right: 10px; bottom: 10px; left: 10px; display: grid; grid-template-columns: repeat(3,1fr); height: auto; min-height: 0; padding: 8px; border-radius: 20px; }
  .side-brand, .side-rule, .side-section, .side-account, .side-logout { display: none; }
  .app-sidebar nav { display: contents; }
  .side-link { min-height: 48px; }
  .side-link span { display: block; font-size: 8px; }
  .app-main { padding: 7px 6px 88px; }
  .page-header { align-items: flex-start; }
  .role-pill { max-width: 130px; text-align: center; }
  .summary-grid { grid-template-columns: 1fr; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading .primary-action { width: 100%; }
}

@media (max-width: 560px) {
  .login-page .login-wave-canvas { display: none !important; }
  .login-page .cloud-shell {
    background:
      radial-gradient(ellipse at 50% 34%, rgba(183, 126, 29, .16), transparent 39%),
      linear-gradient(180deg, #130d04 0%, #090805 58%, #060708 100%);
  }
  .login-page .cloud-shell::before {
    animation: none;
    background: radial-gradient(circle at 50% 48%, rgba(228, 199, 143, .08), transparent 38%);
  }
}
