:root {
  color-scheme: dark;
  --bg: #050914;
  --bg-soft: #0a1020;
  --panel: rgba(13, 22, 39, 0.82);
  --panel-strong: #0e1728;
  --panel-hover: #142039;
  --line: rgba(130, 173, 255, 0.14);
  --line-strong: rgba(84, 233, 255, 0.33);
  --text: #eef5ff;
  --text-soft: #a9bad1;
  --text-dim: #70839d;
  --cyan: #55eaff;
  --blue: #5d8cff;
  --violet: #8c70ff;
  --pink: #ff64ba;
  --green: #4ce6a5;
  --yellow: #ffcc66;
  --red: #ff667d;
  --shadow: 0 18px 48px rgba(0, 0, 0, .32);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --radius-sm: 9px;
  --sidebar: 262px;
  --header: 70px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", sans-serif; }
body { min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 8%, rgba(55, 176, 255, .14), transparent 30%),
    radial-gradient(circle at 86% 12%, rgba(131, 91, 255, .12), transparent 28%),
    linear-gradient(rgba(64, 112, 180, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 112, 180, .035) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .16;
  background-image: linear-gradient(transparent 50%, rgba(255,255,255,.018) 50%);
  background-size: 100% 4px;
  z-index: -1;
}

.hidden { display: none !important; }
.muted { color: var(--text-soft); }
.dim { color: var(--text-dim); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 20px;
}
.login-wrap {
  width: min(1080px, 100%);
  min-height: 650px;
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  background: rgba(8, 15, 27, .85);
  border: 1px solid var(--line);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(84, 233, 255, .035) inset;
  backdrop-filter: blur(20px);
}
.login-visual {
  position: relative;
  padding: 62px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(45, 126, 255, .12), rgba(122, 73, 255, .08)),
    #091323;
}
.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(4px);
}
.login-visual::before { width: 390px; height: 390px; left: -130px; bottom: -130px; border: 1px solid rgba(84, 233, 255, .22); box-shadow: 0 0 80px rgba(84, 233, 255, .08) inset; }
.login-visual::after { width: 230px; height: 230px; right: -50px; top: 95px; border: 1px solid rgba(161, 105, 255, .25); box-shadow: 0 0 70px rgba(146, 92, 255, .08) inset; }
.brand-lockup { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.brand-lockup img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 0 28px rgba(84, 233, 255, .14); }
.brand-kicker { font-size: 11px; letter-spacing: .26em; color: var(--cyan); text-transform: uppercase; }
.brand-name { margin-top: 4px; font-size: 20px; font-weight: 760; letter-spacing: .02em; }
.login-hero { position: relative; z-index: 1; margin-top: 110px; }
.login-hero h1 { margin: 0; font-size: clamp(38px, 5vw, 64px); line-height: 1.04; letter-spacing: -.045em; }
.login-hero h1 span { background: linear-gradient(90deg, var(--cyan), #91a9ff 47%, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { margin: 24px 0 0; max-width: 520px; color: var(--text-soft); font-size: 15px; line-height: 1.75; }
.login-meta { position: absolute; left: 62px; right: 62px; bottom: 45px; display: flex; gap: 14px; flex-wrap: wrap; z-index: 1; }
.meta-chip { padding: 9px 12px; border: 1px solid var(--line); background: rgba(8, 14, 25, .42); border-radius: 999px; color: var(--text-soft); font-size: 12px; }
.login-panel { display: flex; align-items: center; padding: 58px; background: rgba(8, 13, 24, .76); }
.login-card { width: 100%; }
.login-card h2 { margin: 0; font-size: 29px; letter-spacing: -.02em; }
.login-card > p { margin: 10px 0 34px; color: var(--text-soft); line-height: 1.6; }
.form-stack { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 12px; color: var(--text-soft); font-weight: 650; letter-spacing: .02em; }
.input-wrap { position: relative; }
.input-wrap input,
.input-wrap textarea,
.input-wrap select,
.input,
.textarea,
.select {
  width: 100%;
  color: var(--text);
  background: rgba(15, 24, 41, .84);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  padding: 12px 14px;
  transition: .18s ease;
}
.input-wrap input { height: 48px; padding-left: 42px; }
.input-wrap textarea, .textarea { min-height: 110px; resize: vertical; }
.input-wrap input:focus,
.input:focus,
.textarea:focus,
.select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(84, 233, 255, .07); }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-dim); }
.login-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; gap: 12px; }
.login-note { color: var(--text-dim); font-size: 11px; line-height: 1.5; }
.login-footer { margin-top: 30px; color: var(--text-dim); font-size: 11px; }

/* Buttons */
.btn {
  min-height: 40px;
  border-radius: 11px;
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(16, 27, 45, .9);
  padding: 9px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 650;
  font-size: 13px;
  transition: transform .15s ease, border-color .15s ease, background .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(84, 233, 255, .30); background: var(--panel-hover); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { color: #04121a; border-color: transparent; background: linear-gradient(100deg, var(--cyan), #7da1ff); box-shadow: 0 8px 28px rgba(83, 212, 255, .14); }
.btn-primary:hover { background: linear-gradient(100deg, #7ff1ff, #94adff); }
.btn-danger { color: #ffdce3; border-color: rgba(255, 102, 125, .25); background: rgba(255, 102, 125, .10); }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn-icon { width: 38px; height: 38px; padding: 0; }
.btn-block { width: 100%; min-height: 48px; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(0,0,0,.22); border-top-color: rgba(0,0,0,.72); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* App shell */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  z-index: 30;
  background: rgba(6, 12, 22, .94);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  transition: transform .24s ease;
}
.sidebar-head { height: var(--header); display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 11px; }
.sidebar-brand strong { display: block; font-size: 14px; }
.sidebar-brand small { display: block; margin-top: 3px; color: var(--cyan); font-size: 9px; letter-spacing: .2em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 17px 12px 26px; overflow-y: auto; }
.nav-group { margin: 0 0 18px; }
.nav-label { padding: 0 12px 8px; color: #536b8a; font-size: 9px; letter-spacing: .20em; text-transform: uppercase; font-weight: 750; }
.nav-item {
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  border-radius: 11px;
  padding: 0 12px;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  transition: .16s ease;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; }
.nav-item span { flex: 1; font-size: 13px; }
.nav-item:hover { color: var(--text); background: rgba(91, 139, 255, .07); }
.nav-item.active { color: #eaffff; border-color: rgba(84, 233, 255, .13); background: linear-gradient(90deg, rgba(63, 211, 255, .13), rgba(120, 82, 255, .07)); box-shadow: inset 3px 0 0 var(--cyan); }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--line); }
.sidebar-user { padding: 11px; display: flex; align-items: center; gap: 10px; border-radius: 12px; background: rgba(17, 28, 47, .68); }
.avatar { width: 36px; height: 36px; border-radius: 11px; background: linear-gradient(145deg, rgba(84,233,255,.85), rgba(132,100,255,.9)); color: #06101b; font-weight: 850; display: grid; place-items: center; flex: 0 0 auto; }
.sidebar-user-data { min-width: 0; flex: 1; }
.sidebar-user-data strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-data small { display: block; color: var(--text-dim); font-size: 10px; margin-top: 2px; }
.main-shell { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--header); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(5, 10, 19, .78); backdrop-filter: blur(20px); }
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.menu-toggle { display: none; }
.breadcrumbs { color: var(--text-dim); font-size: 12px; }
.breadcrumbs strong { color: var(--text); font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.connection { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 11px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 999px; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(76, 230, 165, .65); }
.content { padding: 30px; max-width: 1700px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-title h1 { margin: 0; font-size: 28px; letter-spacing: -.025em; }
.page-title p { margin: 7px 0 0; color: var(--text-soft); font-size: 13px; line-height: 1.55; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

/* Cards and stats */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card, .panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 34px rgba(0,0,0,.16), inset 0 1px rgba(255,255,255,.018);
  backdrop-filter: blur(14px);
}
.stat-card { padding: 18px; min-height: 130px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 110px; height: 110px; right: -42px; top: -44px; border-radius: 50%; background: radial-gradient(circle, rgba(84,233,255,.12), transparent 68%); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { color: var(--text-soft); font-size: 12px; }
.stat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--cyan); background: rgba(84,233,255,.08); border: 1px solid rgba(84,233,255,.10); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-value { margin-top: 17px; font-size: 28px; font-weight: 800; letter-spacing: -.035em; }
.stat-note { margin-top: 5px; color: var(--text-dim); font-size: 10px; }
.panel { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.panel-title { font-size: 14px; font-weight: 720; }
.panel-subtitle { color: var(--text-dim); font-size: 11px; margin-top: 4px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-card { min-height: 96px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: rgba(13, 23, 40, .6); transition: .16s ease; }
.quick-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(19, 33, 56, .78); }
.quick-card .quick-icon { color: var(--cyan); }
.quick-card strong { display: block; margin-top: 15px; font-size: 12px; }
.quick-card small { color: var(--text-dim); font-size: 10px; }

/* Toolbar and table */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search { position: relative; min-width: 260px; }
.search input { height: 39px; width: 100%; padding: 0 13px 0 37px; color: var(--text); border: 1px solid var(--line); border-radius: 11px; background: rgba(12, 21, 36, .9); outline: none; }
.search input:focus { border-color: var(--line-strong); }
.search svg { position: absolute; width: 15px; height: 15px; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-dim); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: rgba(8, 15, 27, .56); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { height: 44px; padding: 0 14px; text-align: left; color: #8194ae; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; background: rgba(18, 29, 48, .64); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid rgba(130,173,255,.08); color: var(--text-soft); font-size: 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(84, 233, 255, .025); color: #cbd8e8; }
.cell-title { color: var(--text); font-weight: 640; }
.cell-sub { color: var(--text-dim); font-size: 10px; margin-top: 4px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; border: 1px solid var(--line); background: rgba(255,255,255,.025); color: var(--text-soft); font-size: 10px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.green { color: var(--green); border-color: rgba(76,230,165,.18); background: rgba(76,230,165,.06); }
.badge.yellow { color: var(--yellow); border-color: rgba(255,204,102,.18); background: rgba(255,204,102,.06); }
.badge.red { color: var(--red); border-color: rgba(255,102,125,.18); background: rgba(255,102,125,.06); }
.badge.blue { color: #7fb1ff; border-color: rgba(105,164,255,.18); background: rgba(105,164,255,.06); }
.badge.violet { color: #b39aff; border-color: rgba(179,154,255,.18); background: rgba(179,154,255,.06); }

/* Empty / loading / error */
.state-box { min-height: 300px; display: grid; place-items: center; text-align: center; padding: 34px; border: 1px dashed rgba(130,173,255,.16); border-radius: 14px; background: rgba(8, 15, 27, .4); }
.state-box .state-icon { width: 58px; height: 58px; margin: 0 auto 16px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 17px; color: var(--cyan); background: rgba(84,233,255,.05); }
.state-box h3 { margin: 0; font-size: 15px; }
.state-box p { margin: 8px auto 0; max-width: 520px; color: var(--text-dim); font-size: 12px; line-height: 1.7; }
.skeleton { overflow: hidden; position: relative; background: rgba(110, 139, 182, .08); border-radius: 8px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(2, 6, 13, .72); backdrop-filter: blur(8px); }
.modal { width: min(720px, 100%); max-height: min(860px, calc(100vh - 40px)); overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 20px; background: #0a1322; box-shadow: 0 28px 90px rgba(0,0,0,.5); }
.modal-head { min-height: 64px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid .span-2 { grid-column: span 2; }
.help { color: var(--text-dim); font-size: 10px; line-height: 1.5; }
.checkbox-row { display: flex; align-items: center; gap: 9px; min-height: 40px; color: var(--text-soft); font-size: 12px; }
.checkbox-row input { accent-color: var(--cyan); }

/* Toasts */
.toast-root { position: fixed; right: 20px; top: 20px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { border: 1px solid var(--line); border-left: 3px solid var(--cyan); background: rgba(9, 17, 30, .96); backdrop-filter: blur(14px); border-radius: 12px; padding: 13px 14px; box-shadow: var(--shadow); animation: toastIn .2s ease; }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }
.toast-title { font-size: 12px; font-weight: 700; }
.toast-message { margin-top: 4px; color: var(--text-soft); font-size: 11px; line-height: 1.5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* Special panels */
.api-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(11,20,34,.62); }
.api-code { margin-top: 8px; color: var(--cyan); font-size: 11px; }
.permission-list { display: flex; flex-wrap: wrap; gap: 7px; }
.permission-chip { padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line); background: rgba(91,139,255,.05); color: #aabbd1; font-size: 10px; }
.info-banner { margin-bottom: 16px; padding: 13px 15px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid rgba(84,233,255,.16); border-radius: 12px; background: rgba(84,233,255,.045); color: var(--text-soft); font-size: 11px; line-height: 1.6; }
.info-banner strong { color: var(--text); }
.mobile-overlay { display: none; }

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar: 270px; }
  .login-wrap { grid-template-columns: 1fr; min-height: auto; }
  .login-visual { display: none; }
  .login-panel { padding: 40px 28px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .mobile-overlay { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
  .main-shell { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 22px 18px; }
  .topbar { padding: 0 18px; }
  .connection { display: none; }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .search { min-width: 100%; width: 100%; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .modal-body { padding: 16px; }
  .content { padding: 18px 14px; }
  .topbar { height: 62px; }
  .breadcrumbs { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Studio Console v2: real data modules */
.tabs { display:flex; gap:8px; flex-wrap:wrap; margin:0 0 16px; padding:6px; border:1px solid var(--line); border-radius:14px; background:rgba(8,15,27,.56); }
.tab { appearance:none; border:0; border-radius:10px; padding:10px 15px; color:var(--text-dim); background:transparent; cursor:pointer; font-size:12px; transition:.18s ease; }
.tab:hover { color:var(--text); background:rgba(84,233,255,.045); }
.tab.active { color:var(--cyan); background:rgba(84,233,255,.08); box-shadow:inset 0 0 0 1px rgba(84,233,255,.12); }
.permission-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.permission-check { display:flex; gap:9px; align-items:flex-start; padding:11px; border:1px solid var(--line); border-radius:11px; background:rgba(10,18,31,.62); cursor:pointer; }
.permission-check:hover { border-color:var(--line-strong); }
.permission-check input { margin-top:2px; accent-color:var(--cyan); }
.permission-check span { display:grid; gap:3px; min-width:0; }
.permission-check strong { color:var(--text); font-size:11px; overflow-wrap:anywhere; }
.permission-check small { color:var(--text-dim); font-size:9px; overflow-wrap:anywhere; }
.permission-sections { display:grid; gap:14px; }
.permission-section { padding:14px; border:1px solid var(--line); border-radius:13px; background:rgba(7,14,25,.45); }
.permission-section h4 { margin:0 0 11px; color:var(--cyan); font-size:11px; letter-spacing:.08em; text-transform:uppercase; }
.studio-inline-form { margin-top:16px; padding:16px; border:1px solid var(--line); border-radius:14px; background:rgba(10,18,31,.55); }
.select.compact { min-width:150px; height:39px; }
.ticket-detail-grid { display:grid; grid-template-columns:minmax(0,1fr) 310px; gap:16px; }
.ticket-thread { display:grid; gap:12px; }
.message-card { padding:16px; border:1px solid var(--line); border-radius:14px; background:rgba(8,15,27,.65); }
.message-card.inbound { border-left:3px solid #7fb1ff; }
.message-card.outbound { border-left:3px solid var(--green); background:rgba(76,230,165,.025); }
.message-card header { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.message-card header > div { display:grid; gap:4px; }
.message-card header small { color:var(--text-dim); font-size:9px; }
.message-card h4 { margin:14px 0 8px; color:var(--text); font-size:12px; }
.message-card pre { margin:0; color:var(--text-soft); white-space:pre-wrap; overflow-wrap:anywhere; font:11px/1.75 ui-monospace,SFMono-Regular,Consolas,monospace; }
.attachment-list { display:flex; flex-wrap:wrap; gap:7px; margin-top:12px; }
.attachment-list a { text-decoration:none; display:inline-flex; align-items:center; gap:6px; }
.attachment-list svg { width:13px; height:13px; }
.ticket-side-card { margin-bottom:14px; padding:15px; border:1px solid var(--line); border-radius:14px; background:rgba(8,15,27,.65); }
.ticket-side-card h4, .reply-composer h4 { margin:0 0 13px; color:var(--text); font-size:12px; }
.note-list { display:grid; gap:8px; margin-bottom:12px; max-height:220px; overflow:auto; }
.note-card { padding:10px; border:1px solid rgba(130,173,255,.1); border-radius:10px; background:rgba(255,255,255,.018); }
.note-card strong { color:var(--cyan); font-size:10px; }
.note-card span { margin-left:8px; color:var(--text-dim); font-size:9px; }
.note-card p { margin:6px 0 0; color:var(--text-soft); font-size:10px; line-height:1.6; white-space:pre-wrap; }
.reply-composer { margin-top:16px; padding:18px; border:1px solid var(--line-strong); border-radius:15px; background:rgba(84,233,255,.025); }
.dim { color:var(--text-dim); font-size:11px; }
@media(max-width:1050px){.ticket-detail-grid{grid-template-columns:1fr}.permission-grid{grid-template-columns:1fr}}

/* Personal mailbox v2.1 */
#personal-mail-filter .field { min-width: 260px; gap: 4px; }
#personal-mail-filter .field label { display: none; }
#personal-mail-filter .search { min-width: 260px; }
@media (max-width: 760px) {
  #personal-mail-filter .field, #personal-mail-filter .search { min-width: 100%; width: 100%; }
}


/* Electronic staff badge v2.3.0 */
.dashboard-badge-panel { margin-bottom: 16px; overflow: hidden; }
.dashboard-stats { margin-top: 16px; }
.badge-page-panel { padding: 24px; overflow: hidden; }
.staff-id-stage { width: min(1180px, 100%); margin: 0 auto; perspective: 2200px; }
.staff-id-stage.compact { width: min(1040px, 100%); }
.staff-id-card { position: relative; width: 100%; aspect-ratio: 1672 / 941; transform-style: preserve-3d; transition: transform .8s cubic-bezier(.2,.76,.2,1); cursor: pointer; outline: none; }
.staff-id-card:focus-visible { filter: drop-shadow(0 0 18px rgba(84,233,255,.55)); }
.staff-id-card.is-flipped { transform: rotateY(180deg); }
.staff-id-face { position: absolute; inset: 0; overflow: hidden; border-radius: 3.1% / 5.5%; backface-visibility: hidden; background-color: #030713; background-repeat: no-repeat; background-position: center; background-size: 100% 100%; box-shadow: 0 22px 62px rgba(0,0,0,.46), 0 0 34px rgba(45,119,255,.18); }
.staff-id-front { background-image: url('../img/badge-front-final.png'); }
.staff-id-back { background-image: url('../img/badge-back-final.png'); transform: rotateY(180deg); }
.staff-id-photo { position: absolute; left: 8.25%; top: 17.4%; width: 24.1%; height: 61.3%; overflow: hidden; border-radius: 8%; background: linear-gradient(155deg, rgba(11,24,53,.98), rgba(23,35,69,.94)); box-shadow: inset 0 0 34px rgba(26,94,200,.18); }
.staff-id-avatar { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.staff-id-avatar-fallback { display: grid; place-items: center; color: rgba(220,232,255,.9); font-size: clamp(42px, 7vw, 105px); font-weight: 850; letter-spacing: -.06em; background: radial-gradient(circle at 50% 35%, rgba(83,131,219,.26), transparent 28%), linear-gradient(155deg, rgba(17,30,62,.98), rgba(35,45,78,.96)); }
.staff-id-data-cover { position: absolute; left: 37.3%; top: 17.4%; width: 28.9%; height: 62.8%; padding: 1.1% 1.4%; display: grid; grid-template-rows: repeat(4, 1fr); background: linear-gradient(90deg, rgba(3,10,24,.985) 0%, rgba(3,10,24,.94) 82%, rgba(3,10,24,.68) 100%); border-radius: 2.5%; }
.staff-id-field { display: flex; flex-direction: column; justify-content: center; min-height: 0; border-bottom: 1px solid rgba(50,127,238,.65); }
.staff-id-field:last-child { border-bottom: 0; }
.staff-id-field span { color: #e0e9ff; font-size: clamp(11px, 1.45vw, 24px); line-height: 1; }
.staff-id-field span small { color: #8aa1c8; font-size: .54em; letter-spacing: .04em; }
.staff-id-field strong { margin-top: 3.5%; color: #f5f8ff; font-size: clamp(17px, 2.05vw, 35px); line-height: 1.12; font-weight: 560; text-shadow: 0 0 12px rgba(116,168,255,.2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-id-security-cover { position: absolute; left: 69.1%; top: 31.1%; width: 23.6%; height: 45.1%; padding: 2.1% 2.1% 1.7%; display: grid; grid-template-rows: .76fr .9fr 1.65fr; background: rgba(3,10,25,.965); border-radius: 5%; }
.staff-id-status { display: flex; align-items: center; gap: 3%; border-bottom: 1px solid rgba(96,137,205,.46); color: #f3f7ff; min-width: 0; }
.staff-id-status i { width: 4.2%; aspect-ratio: 1; min-width: 7px; border-radius: 50%; background: #50cfff; box-shadow: 0 0 13px rgba(80,207,255,.95); }
.staff-id-status i.suspended, .staff-id-status i.resigned { background: #ff667d; box-shadow: 0 0 13px rgba(255,102,125,.75); }
.staff-id-status i.pending { background: #ffcc66; box-shadow: 0 0 13px rgba(255,204,102,.75); }
.staff-id-status strong { font-size: clamp(13px, 1.85vw, 30px); font-weight: 530; white-space: nowrap; }
.staff-id-status span { color: #93a9ce; font-size: clamp(7px, .8vw, 13px); white-space: nowrap; }
.staff-id-access { display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid rgba(96,137,205,.46); }
.staff-id-access small, .staff-id-verify small { color: #96abd1; font-size: clamp(7px, 1vw, 16px); letter-spacing: .03em; }
.staff-id-access strong { margin-top: 4%; color: #38bdf8; font-size: clamp(11px, 1.5vw, 25px); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-id-verify { display: grid; grid-template-columns: 42% 1fr; gap: 8%; align-items: center; padding-top: 4%; }
.staff-id-verify img { display: block; width: 100%; aspect-ratio: 1; padding: 4%; background: #fff; border: 1px solid rgba(202,224,255,.75); }
.staff-id-verify > div { min-width: 0; display: grid; gap: 5%; }
.staff-id-verify strong { color: #44b8ff; font-size: clamp(8px, 1.15vw, 19px); font-weight: 520; white-space: nowrap; }
.staff-id-verify b { color: #6e8ab8; font-size: clamp(7px, 1vw, 16px); font-weight: 400; }
.staff-id-email { position: absolute; left: 38.6%; bottom: 8.15%; max-width: 28%; padding: .42% .72%; color: rgba(141,178,229,.88); background: rgba(3,10,24,.73); border: 1px solid rgba(75,139,226,.2); border-radius: 999px; font-size: clamp(7px, .78vw, 13px); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-id-flip { position: absolute; right: 3.1%; bottom: 4.2%; z-index: 5; padding: .72% 1.18%; border: 1px solid rgba(84,190,255,.45); border-radius: 999px; color: #dff7ff; background: rgba(5,18,42,.72); backdrop-filter: blur(10px); font-size: clamp(8px, .82vw, 13px); cursor: pointer; transition: .18s ease; }
.staff-id-flip:hover { border-color: rgba(84,233,255,.85); background: rgba(13,39,75,.88); box-shadow: 0 0 18px rgba(84,233,255,.18); }
.staff-id-back-meta { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: .7% 1.4%; border: 1px solid rgba(100,167,255,.25); border-radius: 999px; color: rgba(225,238,255,.86); background: rgba(0,5,16,.38); backdrop-filter: blur(10px); font-size: clamp(8px, .85vw, 14px); letter-spacing: .05em; }
.staff-id-back-meta span { color: #73bfff; }
.staff-id-hint { margin-top: 12px; text-align: center; color: var(--text-dim); font-size: 11px; }
@media (max-width: 900px) { .badge-page-panel { padding: 12px; } .staff-id-stage { width: 100%; } .staff-id-hint { font-size: 10px; } .staff-id-flip { padding: 5px 8px; } }


/* FIRM Studio HR v1 */
.hr-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.hr-metric-card {
  min-height: 132px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 85% 10%, rgba(85, 234, 255, .12), transparent 38%),
    linear-gradient(145deg, rgba(18, 34, 58, .94), rgba(8, 15, 28, .88));
  box-shadow: var(--shadow);
}
.hr-metric-label {
  color: var(--text-soft);
  font-size: 13px;
}
.hr-metric-value {
  margin: 14px 0 8px;
  color: var(--text);
  font-size: 31px;
  font-weight: 760;
  line-height: 1;
}
.hr-metric-note {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}
.hr-two-column {
  display: grid;
  grid-template-columns: minmax(300px, .8fr) minmax(520px, 1.4fr);
  gap: 18px;
}
.hr-department-bars {
  display: grid;
  gap: 16px;
}
.hr-bar-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 13px;
}
.hr-bar-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(93, 140, 255, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .035);
}
.hr-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  box-shadow: 0 0 16px rgba(85, 234, 255, .34);
}
.hr-person-cell,
.hr-profile-summary {
  display: flex;
  align-items: center;
  gap: 13px;
}
.hr-mini-avatar,
.hr-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(85, 234, 255, .34);
  background:
    radial-gradient(circle at 30% 20%, rgba(140, 112, 255, .28), transparent 50%),
    rgba(20, 35, 58, .9);
  color: #fff;
  font-weight: 750;
}
.hr-mini-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}
.hr-avatar {
  width: 92px;
  height: 92px;
  border-radius: 22px;
  box-shadow: 0 0 26px rgba(85, 234, 255, .14);
}
.hr-mini-avatar img,
.hr-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hr-profile-summary {
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(11, 21, 38, .72);
}
.hr-profile-summary h3 {
  margin: 0 0 6px;
  font-size: 24px;
}
.hr-profile-summary p {
  margin: 0 0 10px;
  color: var(--text-soft);
}
.hr-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hr-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.hr-detail-item {
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(11, 20, 35, .68);
}
.hr-detail-item span {
  display: block;
  margin-bottom: 9px;
  color: var(--text-dim);
  font-size: 12px;
}
.hr-detail-item strong {
  color: var(--text);
  font-size: 14px;
  word-break: break-word;
}
.hr-section-title {
  margin: 26px 0 12px;
  color: var(--text);
  font-size: 16px;
}
.modal-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.hr-org-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 16px;
}
.hr-org-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 90% 0, rgba(93, 140, 255, .13), transparent 35%),
    rgba(12, 22, 39, .82);
  box-shadow: var(--shadow);
}
.hr-org-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.hr-org-card-head h3 {
  margin: 0 0 5px;
  font-size: 18px;
}
.hr-org-card-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
}
.hr-org-manager,
.hr-org-footer {
  padding: 13px 20px;
  color: var(--text-soft);
  font-size: 13px;
}
.hr-org-manager {
  border-bottom: 1px solid var(--line);
}
.hr-org-footer {
  border-top: 1px solid var(--line);
}
.hr-position-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.hr-position-item {
  padding: 13px 14px;
  border: 1px solid rgba(130, 173, 255, .11);
  border-radius: var(--radius-md);
  background: rgba(8, 16, 30, .62);
}
.hr-position-item > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.hr-position-item small {
  color: var(--cyan);
}
.hr-position-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hr-position-meta span {
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(93, 140, 255, .1);
  color: var(--text-soft);
  font-size: 11px;
}
@media (max-width: 1320px) {
  .hr-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hr-org-grid { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
}
@media (max-width: 900px) {
  .hr-two-column { grid-template-columns: 1fr; }
  .hr-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hr-org-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .hr-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hr-detail-grid { grid-template-columns: 1fr; }
}
