@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500&display=swap');

@font-face {
  font-family: 'keyplateRoboto';
  src: url('/fonts/Roboto-UI-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'keyplateRoboto';
  src: url('/fonts/Roboto-UI-Bold.ttf') format('truetype');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'keyplateNavRoboto';
  src: url('/fonts/Roboto-500.ttf') format('truetype');
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #212121;
  --panel: #292a2d;
  --panel-2: #303235;
  --line: #44474b;
  --text: #f1f2f2;
  --muted: #a7aaad;
  --cyan: #1e2b2d;
  --cyan-bright: #63aeb8;
  --raspberry: #c34f70;
  font-family: keyplateRoboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; }
.account-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.account-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { text-decoration: none; display: flex; align-items: baseline; gap: 12px; }
.brand strong { font-size: 19px; font-weight: 500; }
.brand span, .mono { font: 11px/1 Geist Mono, monospace; letter-spacing: .055em; color: var(--muted); text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.auth-main { display: grid; place-items: center; padding: 56px 0 96px; }
.auth-frame { width: min(460px, 100%); }
.auth-intro { margin-bottom: 24px; }
.auth-intro h1 { margin: 8px 0; font-size: clamp(34px, 6vw, 58px); line-height: .98; font-weight: 400; letter-spacing: -.045em; }
.auth-intro p { margin: 0; color: var(--muted); line-height: 1.55; }
#clerk-root { min-height: 420px; }
.dashboard { align-self: start; padding: 48px 0 96px; display: grid; gap: 16px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.card h1, .card h2 { margin: 0; font-weight: 400; letter-spacing: -.025em; }
.card h1 { font-size: clamp(32px, 5vw, 54px); }
.card h2 { font-size: 20px; }
.card-label { display: block; margin-bottom: 22px; font: 11px/1 Geist Mono, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.card-heading-row { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.card-heading-row .card-label { margin-bottom: 22px; }
.card-copy { margin: 12px 0 0; max-width: 620px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.device-count { flex: 0 0 auto; padding-top: 2px; color: var(--text); }
.device-warning { margin-top: 20px; padding: 13px 15px; border-radius: 8px; display: grid; gap: 5px; background: #442829; color: #ffb0b0; }
.device-warning[hidden] { display: none; }
.device-warning strong { font-weight: 500; }
.device-warning span { font-size: 12px; line-height: 1.4; }
.device-list { display: grid; gap: 1px; margin-top: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.device-row { min-height: 64px; padding: 11px 12px 11px 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--panel-2); }
.device-identity { min-width: 0; display: grid; gap: 6px; }
.device-title { display: flex; align-items: center; gap: 9px; }
.device-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.device-identity > span { color: var(--muted); font: 10px/1.3 Geist Mono, monospace; }
.device-badge { padding: 4px 6px; border-radius: 4px; color: #bcebcf; background: #23372d; }
.device-empty { padding: 18px 15px; color: var(--muted); background: var(--panel-2); }
.status-action { min-height: 28px; margin-left: 8px; padding: 0 10px; font-size: 11px; }
.account-readout { margin-top: 36px; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.account-line { background: var(--panel-2); padding: 13px 15px; display: flex; justify-content: space-between; gap: 16px; }
.account-line span { color: var(--muted); }
.account-line strong { font: 12px/1.3 Geist Mono, monospace; font-weight: 500; text-align: right; }
.button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 0 15px;
  color: var(--text);
  background: #393b3e;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .16s ease, transform .16s ease;
}
.button:hover { background: #484a4e; }
.button:active { transform: scale(.98); }
.button.primary { background: var(--cyan); color: #ecfbfd; }
.button.raspberry { background: #542c38; color: #ffe9ef; }
.button.app-launch {
  flex: 1 1 190px;
  min-height: 44px;
  justify-content: space-between;
  gap: 24px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,.9);
  transition: background-color 150ms ease, color 150ms ease;
}
.button.app-launch.primary { background: #1e2b2d; }
.button.app-launch.raspberry { background: #2d2027; }
.button.app-launch:hover,.button.app-launch:focus-visible { color: #fff; outline: none; }
.button.app-launch.primary:hover,.button.app-launch.primary:focus-visible { background: #283b3e; }
.button.app-launch.raspberry:hover,.button.app-launch.raspberry:focus-visible { background: #422b36; }
.button.app-launch:active { transform: none; }
.button.app-launch .mono {
  flex: 0 0 auto;
  font: 500 14px/1 'Geist Mono', monospace;
  letter-spacing: 0;
  color: inherit;
}
.button.compact { min-height: 34px; font-size: 12px; }
/* Match Landing's Features & access action, including inline arrow rhythm. */
.button.page-navigation {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  justify-content: center;
  gap: 0;
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.7);
  font: 500 12.5px/13px keyplateNavRoboto, keyplateRoboto, sans-serif;
  letter-spacing: .025em;
  transition: color 150ms ease, background-color 150ms ease;
}
.button.page-navigation:hover,
.button.page-navigation:focus-visible { color: #fff; background: rgba(255,255,255,.1); outline: none; }
.button.page-navigation:active { transform: none; }
@media (max-width:600px) { .button.page-navigation { font-size:12px; } }
.button:disabled { opacity: .45; cursor: wait; }
.button-row { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.status { min-height: 40px; padding: 11px 13px; border-radius: 7px; font: 12px/1.4 Geist Mono, monospace; color: var(--muted); background: var(--panel-2); }
.status[data-kind="error"] { color: #ffb0b0; background: #442829; }
.status[data-kind="success"] { color: #bcebcf; background: #23372d; }
.account-footer { padding-top: 8px; text-align: right; }
.account-footer a { color: var(--muted); font: 10px/1.3 Geist Mono, monospace; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.account-footer a:hover, .account-footer a:focus-visible { color: var(--text); outline: none; }
.form-grid { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 8px; margin-top: 18px; }
.field, .admin-select {
  width: 100%; min-height: 40px; border: 0; outline: 0; border-radius: 7px;
  padding: 0 13px; color: var(--text); background: #37393c;
}
.field:focus, .admin-select:focus { box-shadow: inset 0 0 0 1px #70757a; }
.user-list { display: grid; gap: 8px; margin-top: 18px; }
.user-row { display: grid; grid-template-columns: minmax(220px, 1fr) 170px 130px minmax(120px, auto); align-items: center; gap: 8px; padding: 10px; border-radius: 8px; background: var(--panel-2); }
.user-identity { min-width: 0; display: grid; gap: 4px; }
.user-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-identity span { color: var(--muted); font: 10px/1.35 Geist Mono, monospace; }
.user-actions { display: flex; justify-content: flex-end; gap: 6px; }
.invitation-list { display: grid; gap: 1px; margin-top: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.invitation-row { min-height: 58px; padding: 10px 10px 10px 15px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--panel-2); }
.invitation-identity { min-width: 0; display: grid; gap: 5px; }
.invitation-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.invitation-identity span { color: var(--muted); font: 10px/1.35 Geist Mono, monospace; text-transform: uppercase; }
.invitation-empty { padding: 18px 15px; color: var(--muted); background: var(--panel-2); }
.cl-card { background: var(--panel) !important; border: 1px solid var(--line) !important; box-shadow: none !important; }
.cl-headerTitle, .cl-headerSubtitle { color: var(--text) !important; }
.cl-headerSubtitle, .cl-footerActionText { color: var(--muted) !important; }
.cl-formButtonPrimary { background: var(--cyan) !important; box-shadow: none !important; }
.cl-formFieldInput { background: var(--panel-2) !important; color: var(--text) !important; border-color: var(--line) !important; }
.cl-footer { background: transparent !important; }
.account-settings-card { min-width: 0; }
#account-profile { width: 100%; min-width: 0; }
#account-profile .cl-rootBox,
#account-profile .cl-cardBox { width: 100%; max-width: none; box-shadow: none; }
#account-profile .cl-card { border: 0 !important; background: transparent !important; }
#account-profile .cl-pageScrollBox { box-shadow: none; }
#account-profile .cl-navbar { padding: 0 20px 0 0; border-right: 1px solid var(--line); }
#account-profile .cl-navbarButtons { gap: 8px; }
#account-profile .cl-navbarButton { padding: 0 12px; transition: background .16s ease; }
#account-profile .cl-navbarButton:hover,
#account-profile .cl-navbarButton[data-active="true"] { background: #393b3e; }
#account-profile .cl-pageScrollBox { padding: 0 0 0 24px; }
/* The enclosing page card already names this area. Keep edit-dialog headings. */
#account-profile .cl-profilePage__account > .cl-header { display: none; }
#account-profile .cl-profilePage__account { padding-top: 0; }
#account-profile .cl-profileSection { border-color: var(--line); }
#account-profile .cl-profileSectionPrimaryButton:hover { background: #484a4e; }
#account-profile .cl-formButtonPrimary { background: #393b3e !important; }
#account-profile .cl-formButtonPrimary:hover { background: #484a4e !important; }
#account-profile .cl-profileSectionTitleText,
#account-profile .cl-formFieldLabel { color: var(--text); }
#account-profile .cl-profileSectionSubtitleText { color: var(--muted); }
#account-profile[data-default-avatar="true"] .cl-avatarBox {
  position: relative;
  background: #393939 !important;
  border-radius: 50% !important;
  overflow: hidden;
}
#account-profile[data-default-avatar="true"] .cl-avatarImage { visibility: hidden !important; }
#account-profile[data-default-avatar="true"] .cl-avatarBox::after {
  content: var(--keyplate-account-initial, '?');
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #eee;
  font: 400 20px/1 keyplateRoboto, sans-serif;
  pointer-events: none;
}
@media (max-width: 760px) {
  #account-profile .cl-navbar { padding: 0; border: 0; }
  #account-profile .cl-pageScrollBox { padding: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid, .user-row { grid-template-columns: 1fr; }
  .account-header { min-height: 64px; }
  .device-row { align-items: stretch; flex-direction: column; }
  .device-row .button { width: 100%; }
  .user-actions { justify-content: stretch; }
  .user-actions .button { flex: 1 1 0; }
  .invitation-row { align-items: stretch; flex-direction: column; }
  .invitation-row .button { width: 100%; }
}
