:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #10284c;
  background: #eef4fb;
  font-synthesis: none;
  --navy: #0b4fa8;
  --navy-deep: #06295f;
  --blue: #1267d5;
  --blue-strong: #084b9d;
  --sky: #e8f5ff;
  --sky-soft: #f7faff;
  --aqua: #08c9c2;
  --mint: #38d59c;
  --ink: #0a2b55;
  --muted: #637b9d;
  --line: #cad9ec;
  --surface: #ffffff;
  --danger: #da4b66;
  --warning: #ffae42;
  --success: #2bb673;
  --shadow: 0 28px 70px rgba(29, 78, 146, 0.18);
  --shadow-soft: 0 12px 34px rgba(29, 78, 146, 0.10);
  --radius: 0;
  --radius-sm: 0;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100vh; }
body {
  background: linear-gradient(135deg, #f7faff 0%, #edf5ff 48%, #ecfbfa 100%);
  color: var(--ink);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 22px;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(135deg, #f8fbff 0%, #edf5ff 44%, #effcfb 72%, #f9fbff 100%);
}
.login-shell::before,
.login-shell::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}
.login-shell::before {
  width: 125vw;
  height: 66vh;
  left: -18vw;
  bottom: -21vh;
  background: linear-gradient(110deg, rgba(35, 113, 222, .14), rgba(100, 164, 245, .08) 48%, rgba(8, 201, 194, .12));
  clip-path: polygon(0 26%, 29% 4%, 66% 34%, 100% 0, 100% 100%, 0 100%);
  transform: rotate(-3deg);
}
.login-shell::after {
  width: 82vw;
  height: 46vh;
  right: -20vw;
  top: -16vh;
  background: linear-gradient(125deg, rgba(11, 79, 168, .04), rgba(65, 139, 236, .13) 52%, rgba(8, 201, 194, .07));
  clip-path: polygon(12% 0, 100% 0, 100% 77%, 66% 100%, 26% 70%);
  transform: rotate(4deg);
}

.login-card {
  position: relative;
  z-index: 2;
  width: min(100%, 610px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(190, 211, 236, .82);
  border-radius: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.login-brand-panel {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 180px;
  padding: 34px 48px 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f4f9ff 48%, #edfcfa 100%);
}
.login-brand-panel::before {
  content: "";
  position: absolute;
  inset: auto -18% -56% -18%;
  height: 78%;
  background: linear-gradient(105deg, rgba(18, 103, 213, .06), rgba(8, 201, 194, .12));
  clip-path: polygon(0 34%, 42% 0, 100% 40%, 100% 100%, 0 100%);
}
.login-form-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 54px 42px;
}
.login-heading {
  position: relative;
  margin-bottom: 26px;
  padding-bottom: 17px;
  text-align: center;
}
.login-heading::after {
  content: "";
  position: absolute;
  width: 56px;
  height: 4px;
  left: calc(50% - 28px);
  bottom: 0;
  background: linear-gradient(90deg, var(--blue), var(--aqua));
}
.login-heading span {
  color: var(--navy);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.logo-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 138px;
}
.logo-stage.compact { min-height: 92px; }
.login-logo { width: min(360px, 88%); display: block; }
.animated-logo {
  position: relative;
  z-index: 2;
  animation: none;
  filter: drop-shadow(0 8px 14px rgba(6, 41, 95, 0.16));
  transform: none;
  will-change: auto;
}
.login-heading h1 {
  margin: 5px 0 0;
  font-size: clamp(2rem, 4vw, 2.7rem);
  color: var(--navy-deep);
}
.lead {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 22px;
}
.center { text-align: center; }
.login-form, .security-card form, #userForm {
  display: grid;
  gap: 12px;
}
label {
  font-weight: 700;
  color: var(--navy-deep);
  font-size: .97rem;
}
input, select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
input:focus, select:focus {
  border-color: rgba(47,111,255,0.45);
  box-shadow: 0 0 0 4px rgba(47,111,255,0.10);
}
input[type="file"] {
  padding: 12px;
  min-height: auto;
}
.helper {
  margin-top: -6px;
  color: var(--muted);
  font-size: .9rem;
}
.button {
  border: none;
  border-radius: 0;
  min-height: 50px;
  padding: 0 18px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; box-shadow: none; }
.button.primary {
  background: linear-gradient(112deg, var(--blue) 0%, #0c75ca 58%, #08aaa8 130%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(18, 103, 213, .22);
}
.button.secondary {
  background: #f2f7ff;
  color: var(--navy);
  border: 1px solid var(--line);
}
.button.warning {
  background: #fff7e8;
  color: #9f6200;
  border: 1px solid #ffd08a;
}
.button.danger {
  background: #fff2f4;
  color: #c43856;
  border: 1px solid #f7bac7;
}
.button.full { width: 100%; }
.text-button {
  border: none;
  background: transparent;
  color: #dce8ff;
  font-weight: 700;
  padding: 0;
}
.icon-button {
  width: 40px; height: 40px; border-radius: 0; border: 1px solid var(--line); background: #f4f7fb; color: var(--navy); font-size: 1.5rem;
}
.demo-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 0;
  background: #f5f8ff;
  color: var(--muted);
  display: grid;
  gap: 4px;
}
.form-message {
  min-height: 1.25rem;
  margin: 0;
  font-size: .94rem;
}
.form-message.error { color: #c43856; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background: linear-gradient(135deg, #f8fbff 0%, #eef6ff 58%, #effcfb 100%);
}
.sidebar {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(160deg, #0a64c8 0%, #0752aa 42%, #06295f 100%);
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.08);
}
.sidebar::before,
.sidebar::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}
.sidebar::before {
  width: 410px;
  height: 420px;
  left: -170px;
  top: 110px;
  background: linear-gradient(145deg, rgba(86, 161, 249, .28), rgba(8, 201, 194, .06));
  clip-path: polygon(0 21%, 100% 0, 76% 100%, 6% 77%);
  transform: rotate(-11deg);
}
.sidebar::after {
  width: 390px;
  height: 430px;
  right: -235px;
  bottom: 70px;
  background: linear-gradient(145deg, rgba(52, 132, 229, .28), rgba(7, 55, 120, .06));
  clip-path: polygon(21% 0, 100% 25%, 78% 100%, 0 78%);
  transform: rotate(12deg);
}
.side-brand {
  display: flex;
  justify-content: center;
  padding-bottom: 8px;
}
.sidebar-logo { width: 180px; max-width: 100%; }
.sidebar nav {
  display: grid;
  gap: 12px;
}
.nav-item {
  border: none;
  background: transparent;
  color: #eaf2ff;
  text-align: left;
  padding: 16px 18px;
  border-radius: 0;
  font-weight: 700;
}
.nav-item.active, .nav-item:hover {
  border-left: 5px solid var(--aqua);
  background: rgba(255,255,255,0.13);
}
.side-footer {
  margin-top: auto;
  padding-top: 10px;
}
.content {
  position: relative;
  padding: 24px;
  background:
    linear-gradient(122deg, rgba(74, 145, 234, .045), transparent 38%),
    linear-gradient(306deg, rgba(8, 201, 194, .055), transparent 42%);
}
.topbar {
  background: linear-gradient(135deg, rgba(255,255,255,.98) 0%, rgba(242,248,255,.96) 64%, rgba(237,252,250,.94) 100%);
  border: 1px solid rgba(219,229,240,0.9);
  border-radius: 0;
  padding: 26px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-soft);
}
.topbar h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  color: var(--navy-deep);
}
.topbar p, .subcopy { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.metrics {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}
.metrics article {
  background: linear-gradient(145deg, #ffffff 0%, #fbfdff 70%, #f4fbfb 100%);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
}
.metrics article[data-tone="blue"] { border-top: 4px solid #3da2ff; }
.metrics article[data-tone="green"] { border-top: 4px solid #4ed7a0; }
.metrics article[data-tone="sky"] { border-top: 4px solid #71c7ff; }
.metrics article[data-tone="navy"] { border-top: 4px solid #274f95; }
.metrics article[data-tone="aqua"] { border-top: 4px solid #35dcc8; }
.metrics span:not(.metric-icon), .metrics small { display: block; color: var(--muted); }
.metrics strong { display: block; margin-top: 10px; font-size: 3rem; color: var(--navy-deep); }
.panel {
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(250,253,255,.98));
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 22px;
  margin-top: 20px;
  box-shadow: var(--shadow-soft);
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-heading h3 { margin: 0; font-size: 1.8rem; color: var(--navy-deep); }
.search-box { min-width: min(100%, 380px); }
.search { background: #fbfdff; }
.table-wrap { overflow-x: auto; }
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.table-wrap th {
  text-align: left;
  font-size: .88rem;
  color: #7a8aa6;
  font-weight: 800;
  padding: 14px 12px;
  background: #f2f7fb;
}
.table-wrap th:first-child { border-top-left-radius: 0; }
.table-wrap th:last-child { border-top-right-radius: 0; }
.table-wrap td {
  padding: 14px 12px;
  border-bottom: 1px solid #edf2f7;
  vertical-align: middle;
}
.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-cell .meta { display: grid; gap: 3px; }
.user-cell strong { color: var(--navy-deep); }
.user-cell span { color: var(--muted); font-size: .95rem; }
.avatar {
  width: 42px; height: 42px; border-radius: 0;
  background: linear-gradient(135deg, #dce8ff, #eef5ff);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--navy); font-weight: 800; overflow: hidden; flex: 0 0 auto;
  border: 1px solid #d9e6ff;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.large { width: 88px; height: 88px; font-size: 1.6rem; }
.avatar.xlarge { width: 96px; height: 96px; font-size: 1.8rem; }
.plan, .status {
  display: inline-flex;
  align-items: center;
  border-radius: 0;
  padding: 8px 12px;
  font-weight: 800;
  font-size: .88rem;
}
.plan.normal { background: #ebf2ff; color: #2c58a8; }
.plan.premium { background: #eafaf3; color: #168761; }
.status.active { background: #ebfbf2; color: #15865f; }
.status.expired { background: #fff4e8; color: #ad6a00; }
.status.suspended { background: #fff2f4; color: #c43856; }
.subtle { color: var(--muted); }
.row-action {
  border: 1px solid #dbe6ff;
  background: #f8fbff;
  color: var(--navy);
  min-height: 42px;
  padding: 0 16px;
  border-radius: 0;
  font-weight: 800;
}
.global-message {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 0;
  border: 1px solid #bfe9d2;
  background: #effcf4;
  color: #167857;
}
.global-message.error {
  border-color: #f2b8c5;
  background: #fff3f6;
  color: #c43856;
}
.empty {
  padding: 22px; text-align: center; color: var(--muted);
}
.audit-list { display: grid; gap: 12px; }
.audit-item {
  display: grid; grid-template-columns: 190px 1fr 1fr; gap: 12px;
  padding: 15px 16px; border: 1px solid var(--line); border-radius: 0; background: #fbfdff;
}
.audit-time, .audit-user { color: var(--muted); }
.audit-event { font-weight: 700; color: var(--navy-deep); }
.security-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.security-card h3 { margin-top: 0; }
.profile-preview-block { margin-bottom: 12px; }
.photo-editor {
  display: flex; gap: 16px; align-items: center; margin-bottom: 18px;
}
.photo-editor-fields { flex: 1; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.form-grid .wide { grid-column: 1 / -1; }
.dialog-heading {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px;
}
.dialog-heading h3 { margin: 0; color: var(--navy-deep); font-size: 1.55rem; }
.eyebrow {
  margin: 0 0 4px; letter-spacing: .12em; font-size: .8rem; font-weight: 800; color: #7b8aaa;
}
dialog {
  width: min(100%, 720px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border: 1px solid var(--line); border-radius: 0; padding: 22px; box-shadow: 0 30px 75px rgba(6,41,95,.24); background: linear-gradient(145deg, #fff, #fbfdff); color: var(--ink);
}
dialog::backdrop { background: rgba(12, 24, 49, 0.45); }
.manage-hero {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
.manage-description { margin: 0; color: var(--muted); line-height: 1.5; }
.manage-section {
  padding: 16px 0; border-top: 1px solid #edf2f7;
}
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.inline-form { display: flex; gap: 10px; margin-top: 10px; }
.inline-form input { flex: 1 1 auto; }
.inline-form .button { flex: 0 0 auto; white-space: nowrap; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .security-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .login-card { width: min(100%, 610px); }
  .login-brand-panel { min-height: 170px; padding: 30px 38px 4px; border: 0; }
  .login-form-panel { padding: 8px 38px 36px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .content { padding: 14px; }
  .login-shell { padding: 16px 12px; }
  .login-card { min-height: 0; }
  .login-brand-panel { min-height: 146px; padding: 24px 20px 2px; }
  .login-form-panel { padding: 6px 20px 28px; }
  .logo-stage { min-height: 112px; }
  .login-logo { width: min(310px, 88%); }
  .login-heading { margin-bottom: 22px; }
  .metrics { grid-template-columns: 1fr; }
  .panel, .topbar { padding: 18px; border-radius: 0; }
  .stack-mobile { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .photo-editor, .manage-hero, .inline-form, .dialog-actions { flex-direction: column; align-items: stretch; }
  .audit-item { grid-template-columns: 1fr; }
  dialog { width: calc(100% - 14px); padding: 16px; }
}
