:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f0f3f6;
  --line: #dce3ea;
  --text: #17202a;
  --muted: #667789;
  --soft: #8a98a8;
  --accent: #257a66;
  --accent-2: #1f6a59;
  --danger: #9f3d3d;
  --mono: "Cascadia Mono", "Consolas", monospace;
  font-family: "Segoe UI", "Arial", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shell {
  min-height: 100dvh;
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 0 28px;
  border-bottom: 1px solid var(--line);
}

.brand-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-title {
  margin-top: 6px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.top-actions,
.status-row,
.control-row,
.task-line,
.form-row,
.session-row {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 22px;
  margin-top: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.panel-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.panel-body {
  padding: 20px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  padding: 15px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-value {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 28px;
  line-height: 1;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field label,
.section-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.select {
  position: relative;
}

.select-head {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-align: left;
}

.select-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.select-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
}

.chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--soft);
  border-bottom: 2px solid var(--soft);
  transform: rotate(45deg);
}

.select.open .chevron {
  transform: rotate(225deg);
}

.dropdown {
  display: none;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.select.open .dropdown {
  display: block;
}

.search,
.compact-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.search:focus,
.compact-input:focus {
  border-color: var(--accent);
}

.options {
  max-height: 220px;
  overflow: auto;
  margin-top: 8px;
  display: grid;
  gap: 4px;
}

.option {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  text-align: left;
}

.option:hover {
  background: var(--panel-2);
}

.control-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.timer {
  font-family: var(--mono);
  font-size: clamp(42px, 8vw, 72px);
  line-height: 1;
  letter-spacing: 0;
}

.control-row {
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.button,
.primary,
.danger,
.ghost {
  min-height: 42px;
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 760;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:active,
.primary:active,
.danger:active,
.ghost:active {
  transform: translateY(1px) scale(0.99);
}

.primary {
  color: #fff;
  background: var(--accent);
}

.primary:hover {
  background: var(--accent-2);
}

.danger {
  color: #fff;
  background: var(--danger);
}

.ghost,
.button {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.status-card {
  display: grid;
  gap: 14px;
}

.status-row {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.status.online::before {
  background: var(--accent);
  animation: pulse 1.4s infinite;
}

.remote-message {
  color: var(--muted);
  line-height: 1.45;
}

.remote-grid {
  display: grid;
  gap: 8px;
}

.remote-row,
.task-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.remote-key {
  color: var(--muted);
}

.remote-value,
.task-time {
  font-family: var(--mono);
}

.task-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.task-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.task-pick,
.task-link {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.task-pick {
  padding: 11px 12px;
  color: var(--text);
  text-align: left;
}

.task-link {
  display: grid;
  place-items: center;
  min-height: 42px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
}

.task-pick:hover,
.task-link:hover {
  background: var(--panel-2);
}

.task-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

.form-card {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.form-row {
  gap: 8px;
}

.short-input {
  width: 140px;
  flex: 0 0 140px;
}

.session-row {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.session-row:empty {
  display: none;
}

.empty {
  padding: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 8px;
}

.login-card {
  width: min(100%, 420px);
  margin: 10vh auto 0;
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.login-card h1 {
  margin: 8px 0;
  font-size: 34px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.login-card input,
.login-card button {
  width: 100%;
  height: 46px;
  border-radius: 9px;
}

.login-card input {
  border: 1px solid var(--line);
  padding: 0 12px;
  margin-bottom: 10px;
}

.error {
  margin-top: 10px;
  color: var(--danger);
  font-weight: 700;
}

svg {
  display: block;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@media (max-width: 840px) {
  .shell {
    padding: 18px 14px 28px;
  }

  .topbar,
  .layout,
  .forms,
  .metrics {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions button {
    flex: 1;
  }
}
