:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #19211f;
  --muted: #65716c;
  --line: #d8ded9;
  --panel: #ffffff;
  --accent: #1b6b54;
  --accent-2: #0f547d;
  --warn: #b4541b;
  --soft: #e8f1ed;
  --shadow: 0 16px 40px rgba(35, 47, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.login-panel {
  width: min(460px, calc(100vw - 32px));
  margin: 9vh auto;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 8px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 25px;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

p {
  color: var(--muted);
}

.form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
}

textarea {
  resize: vertical;
}

.form button,
.primary,
.composer button[type="submit"],
.admin-form button {
  padding: 11px 14px;
  color: white;
  background: var(--accent);
  border-radius: 7px;
  font-weight: 700;
}

.error {
  min-height: 20px;
  color: #b3261e;
}

.app {
  display: grid;
  grid-template-columns: 310px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: #edf2ee;
  border-right: 1px solid var(--line);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.side-head strong,
.side-head span {
  display: block;
}

.side-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.usage {
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.usage div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}

.bar {
  height: 8px;
  overflow: hidden;
  background: #dbe4df;
  border-radius: 100px;
}

.bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent-2);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tab {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.tab.active {
  color: white;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.session-list {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.session-item {
  padding: 10px;
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.session-item strong {
  display: block;
  margin-bottom: 4px;
}

.session-item span {
  color: var(--muted);
  font-size: 12px;
}

.content {
  padding: 22px;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
  min-height: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head select {
  max-width: 260px;
}

.coach-controls {
  display: grid;
  gap: 10px;
  min-width: min(520px, 42vw);
}

.coach-controls select {
  max-width: none;
}

.voice-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.2fr);
  gap: 8px;
}

.rate-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 38px 1fr 54px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.rate-control input {
  padding: 0;
}

.rate-control b {
  color: var(--ink);
  font-size: 13px;
  text-align: right;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 18px;
  background: #fbfcfa;
}

.message {
  max-width: min(780px, 92%);
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.message.user {
  align-self: flex-end;
  color: white;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.message.assistant {
  align-self: flex-start;
  background: white;
}

.composer {
  display: grid;
  grid-template-columns: 48px 1fr 76px 88px;
  gap: 10px;
  padding: 14px 18px 8px;
  border-top: 1px solid var(--line);
}

.round {
  width: 48px;
  height: 48px;
  color: white;
  background: var(--warn);
  border-radius: 50%;
  font-size: 20px;
}

.round.listening {
  background: #b3261e;
  box-shadow: 0 0 0 6px rgba(179, 38, 30, 0.14);
}

.stop {
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 700;
}

.hint {
  margin: 0;
  padding: 0 18px 14px;
  font-size: 13px;
}

.cards,
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  overflow: auto;
  padding: 18px;
}

.card,
.vocab-card {
  padding: 14px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.vocab-card strong {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-2);
  font-size: 18px;
}

.vocab-card b,
.vocab-card span {
  display: block;
  margin-bottom: 8px;
}

.vocab-card span {
  color: var(--muted);
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  overflow: auto;
  padding: 18px;
}

.table {
  display: grid;
  gap: 8px;
}

.row {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.row small {
  color: var(--muted);
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .content {
    padding: 12px;
  }

  .panel {
    height: auto;
    min-height: 620px;
  }

  .panel-head,
  .admin-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .panel-head select,
  .coach-controls {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .voice-controls {
    grid-template-columns: 1fr;
  }

  .rate-control {
    grid-template-columns: 38px 1fr 54px;
  }

  .composer,
  .admin-form {
    grid-template-columns: 1fr;
  }

  .round {
    width: 100%;
    border-radius: 7px;
  }
}
