:root {
  --bg: #edf1f5;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-solid: #ffffff;
  --line: #d8e0e8;
  --text: #111b26;
  --muted: #617184;
  --primary: #0f66b3;
  --primary-strong: #084f8f;
  --ok: #0d7a4b;
  --warn: #b84a21;
  --danger: #b42335;
  --shadow: 0 18px 50px rgba(25, 39, 54, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 10%, rgba(15, 102, 179, 0.10), transparent 30%),
    linear-gradient(180deg, #f7f9fb 0%, var(--bg) 100%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 30px auto 52px;
}

.login-body {
  min-height: 100vh;
}

.login-body .shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.login-body .topbar {
  display: none;
}

.login-wrap {
  width: min(440px, 100%);
}

.login-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(210, 220, 231, 0.95);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--primary), #39a2ae);
}

.login-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #102235;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}

.login-card h2 {
  font-size: 1.8rem;
  margin: 0 0 8px;
}

.login-copy {
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.35rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 1.12rem;
}

.account {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px 8px 14px;
  box-shadow: 0 8px 24px rgba(25, 39, 54, 0.06);
}

.account span {
  font-weight: 850;
}

.account small {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
}

.account a {
  color: var(--primary);
  font-weight: 800;
}

.panel, .notice, .error, .metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(25, 39, 54, 0.06);
  backdrop-filter: blur(12px);
}

.notice, .error {
  padding: 14px 16px;
  margin-bottom: 16px;
}

.notice {
  border-color: rgba(13, 122, 75, 0.35);
  background: #f2fbf6;
}

.error {
  border-color: rgba(180, 35, 53, 0.35);
  background: #fff5f6;
}

.tx-confirmation {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(13, 122, 75, 0.35);
  border-radius: 12px;
  background: linear-gradient(180deg, #f2fbf6, #ffffff);
  box-shadow: 0 10px 30px rgba(25, 39, 54, 0.06);
}

.tx-confirmation span,
.tx-confirmation dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tx-confirmation strong {
  display: block;
  margin-top: 4px;
  color: var(--ok);
  font-size: 1.4rem;
}

.tx-confirmation dl {
  display: grid;
  grid-template-columns: 145px 120px minmax(0, 1fr);
  gap: 12px;
  margin: 0;
}

.tx-confirmation dd {
  margin: 4px 0 0;
  font-weight: 800;
}

.status-grid {
  display: grid;
  grid-template-columns: 160px 160px minmax(260px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 1.28rem;
}

.metric strong.free {
  color: var(--ok);
}

.metric strong.busy {
  color: var(--warn);
}

.metric strong.unknown {
  color: var(--muted);
}

.metric em {
  display: block;
  margin-top: 6px;
  color: var(--danger);
  font-style: normal;
  font-size: 0.9rem;
}

.connected-list {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.connected-list small {
  color: var(--muted);
  line-height: 1.25;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  font-weight: 800;
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #c8d3de;
  border-radius: 9px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: rgba(15, 102, 179, 0.65);
  box-shadow: 0 0 0 4px rgba(15, 102, 179, 0.12);
}

textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.5;
}

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 15px;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #fff;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 102, 179, 0.18);
}

button.secondary {
  background: #e8eef4;
  color: #17314b;
  box-shadow: none;
}

button.danger {
  background: #fff0f2;
  color: var(--danger);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

.templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.templates button {
  padding: 8px 10px;
  font-size: 0.9rem;
}

.voice-settings {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(248, 251, 253, 0.8);
  padding: 11px 12px;
}

.voice-settings summary {
  cursor: pointer;
  font-weight: 850;
  color: #17314b;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.voice-grid label {
  margin-bottom: 0;
}

.voice-grid label > span:first-of-type {
  color: var(--primary);
  font-weight: 900;
}

.voice-control {
  border: 1px solid rgba(200, 211, 222, 0.8);
  border-radius: 10px;
  background: #fff;
  padding: 12px;
}

.meter {
  position: relative;
  display: block;
  width: min(160px, 100%);
  aspect-ratio: 2 / 1;
  margin: 6px auto 2px;
  overflow: hidden;
}

.meter-arc {
  position: absolute;
  inset: 0;
  border-radius: 160px 160px 0 0;
  background:
    conic-gradient(from 270deg at 50% 100%, #0d7a4b 0deg 54deg, #d59b19 54deg 112deg, #b42335 112deg 180deg, transparent 180deg);
}

.meter-arc::after {
  content: "";
  position: absolute;
  inset: 14px 14px 0;
  border-radius: 140px 140px 0 0;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(200, 211, 222, 0.9);
}

.meter-needle {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 3px;
  height: 78%;
  border-radius: 999px;
  background: #102235;
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(-70deg);
  transition: transform 160ms ease-out;
  z-index: 2;
}

.meter-hub {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: #102235;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(16, 34, 53, 0.25);
  transform: translate(-50%, 50%);
  z-index: 3;
}

.live-vu {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 8px 0 12px;
  border: 1px solid rgba(200, 211, 222, 0.8);
  border-radius: 10px;
  background: #fff;
  padding: 14px 12px 10px;
}

.live-meter {
  width: min(230px, 100%);
  margin-top: 0;
}

.live-meter .meter-arc {
  background:
    conic-gradient(from 270deg at 50% 100%, #0d7a4b 0deg 90deg, #d59b19 90deg 138deg, #b42335 138deg 180deg, transparent 180deg);
}

.live-vu strong {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.tx-vu {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 12px 0 4px;
  border: 1px solid rgba(15, 102, 179, 0.25);
  border-radius: 10px;
  background: #eef7ff;
  padding: 12px;
}

.tx-meter {
  width: min(190px, 100%);
  margin-top: 0;
}

.tx-vu strong {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.voice-grid input[type="range"] {
  padding: 0;
  accent-color: var(--primary);
}

.range-caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.range-caption em {
  font-style: normal;
}

.voice-grid small {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

.preview audio {
  width: 100%;
  margin: 10px 0;
}

.preview p {
  color: var(--muted);
  line-height: 1.45;
}

.user-form, .password-form {
  display: grid;
  grid-template-columns: 1fr 1fr 160px auto;
  gap: 10px;
  margin-bottom: 16px;
}

.template-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 100px minmax(320px, 2fr) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 16px;
}

.template-form textarea {
  min-height: 58px;
}

.password-form {
  grid-template-columns: 1fr 1fr 1fr auto;
}

.schedule-form {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.schedule-message label,
.schedule-controls label {
  margin-bottom: 0;
}

.schedule-controls {
  display: grid;
  gap: 12px;
}

.schedule-weekly {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
}

.schedule-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(15, 102, 179, 0.25);
  border-radius: 9px;
  background: #eef7ff;
  padding: 10px 12px;
  color: #17314b;
  font-weight: 800;
}

.schedule-form textarea {
  min-height: 132px;
}

.inline-form {
  display: inline-block;
  margin: 0 4px 4px 0;
}

.inline-form button {
  padding: 7px 9px;
  font-size: 0.84rem;
}

.row-actions {
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  border-top: 1px solid #e3e9ef;
  padding: 11px 8px;
  vertical-align: top;
}

th {
  color: #415161;
  font-size: 0.88rem;
}

.state {
  display: inline-block;
  border: 1px solid #cfd7df;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.88rem;
  background: #fff;
}

.state.ok {
  border-color: rgba(13, 122, 75, 0.35);
  color: var(--ok);
  background: #f2fbf6;
}

.state.muted {
  color: var(--muted);
  background: #f2f4f7;
}

@media (max-width: 900px) {
  .topbar, .account, .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .status-grid, .workspace, .user-form, .template-form, .schedule-form, .password-form, .voice-grid, .tx-confirmation, .tx-confirmation dl {
    grid-template-columns: 1fr;
  }
}
