:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #202620;
  background: #f4f6f2;
  letter-spacing: 0;
  --surface: #ffffff;
  --surface-muted: #eef2ec;
  --border: #cbd3c9;
  --border-strong: #929c91;
  --text: #202620;
  --muted: #626b62;
  --accent: #236b47;
  --accent-hover: #195638;
  --accent-soft: #e4efe7;
  --danger: #9a352d;
  --focus: #2d7c53;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #f4f6f2;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f4f6f2;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
}

button,
input {
  min-height: 44px;
  border-radius: 6px;
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  padding: 0 18px;
  cursor: pointer;
  white-space: nowrap;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

input {
  width: 100%;
  border: 1px solid var(--border-strong);
  padding: 9px 12px;
  background: var(--surface);
  color: var(--text);
}

input:read-only {
  border-color: var(--border);
  background: var(--surface-muted);
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.3;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 650;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.secondary-button {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

.secondary-button:hover:not(:disabled),
.quiet-button:hover:not(:disabled),
.icon-button:hover:not(:disabled) {
  background: var(--surface-muted);
}

.quiet-button {
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-group label {
  font-size: 14px;
  font-weight: 650;
}

.field-note {
  color: var(--muted);
  font-size: 13px;
}

.form-message,
.panel-message {
  min-height: 24px;
  margin-bottom: 0;
  color: var(--danger);
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 400px);
}

.login-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(32, 38, 32, 0.08);
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100% - 40px, 1040px);
  min-height: 72px;
  margin: 0 auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-shell {
  width: min(100% - 40px, 1040px);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.panel-message {
  margin-bottom: 12px;
}

.client-list {
  display: grid;
  gap: 12px;
}

.client-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) 104px minmax(0, 2fr);
  align-items: center;
  gap: 18px;
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
}

.client-heading {
  min-width: 0;
}

.row-status {
  display: block;
  min-height: 21px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.generate-button {
  width: 104px;
}

.result-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 58px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.result-area[hidden] {
  display: none;
}

.url-field {
  min-width: 0;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

.copy-button {
  width: 82px;
  padding: 0 12px;
}

.countdown {
  width: 58px;
  color: var(--accent-hover);
  font-family: Consolas, "Courier New", monospace;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.password-dialog {
  width: min(calc(100% - 32px), 440px);
  max-height: calc(100vh - 32px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(32, 38, 32, 0.18);
}

.password-dialog::backdrop {
  background: rgba(22, 28, 23, 0.55);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  padding: 9px 14px 9px 20px;
}

.dialog-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 14px 20px;
}

.clipboard-fallback {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 760px) {
  .header-inner,
  .dashboard-shell {
    width: min(100% - 24px, 1040px);
  }

  .header-inner {
    min-height: 68px;
    gap: 12px;
  }

  .header-actions {
    gap: 2px;
  }

  .header-actions button {
    padding: 0 11px;
  }

  .dashboard-shell {
    padding-top: 20px;
  }

  .client-row {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 14px 10px;
    min-height: 0;
    padding: 16px;
  }

  .generate-button {
    width: 96px;
  }

  .result-area {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 76px;
  }

  .copy-button {
    width: 76px;
  }

  .countdown {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 420px) {
  .login-page {
    padding: 16px;
  }

  .login-panel {
    padding: 22px 18px;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }

  .header-actions {
    width: 100%;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
