/* Shortline UI — plain HTML/CSS, no build step. Edit directly and refresh. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --border: #d8dde3;
  --ink: #1c232b;
  --muted: #5c6773;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e6f4f1;
  --accent-soft-border: #bfe3dd;
  --danger: #b3402f;
  --danger-bg: #fbeae7;
  --danger-border: #f0c9c2;
  --amber: #9a6b12;
  --amber-bg: #fbf1de;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(20, 28, 36, 0.04);
  --mono: "Cascadia Code", "Consolas", monospace;
  --sans: -apple-system, "Segoe UI", system-ui, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1417;
    --surface: #171d22;
    --surface-2: #1d242a;
    --border: #2b333a;
    --ink: #e6eaed;
    --muted: #8a97a1;
    --accent: #2dd4bf;
    --accent-ink: #062421;
    --accent-soft: #123330;
    --accent-soft-border: #1d5750;
    --danger: #e8988a;
    --danger-bg: #3a2220;
    --danger-border: #5c322d;
    --amber: #e0b458;
    --amber-bg: #382d16;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1417; --surface: #171d22; --surface-2: #1d242a; --border: #2b333a; --ink: #e6eaed;
  --muted: #8a97a1; --accent: #2dd4bf; --accent-ink: #062421; --accent-soft: #123330;
  --accent-soft-border: #1d5750; --danger: #e8988a; --danger-bg: #3a2220; --danger-border: #5c322d;
  --amber: #e0b458; --amber-bg: #382d16; --shadow: none;
}
:root[data-theme="light"] {
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #eef1f4; --border: #d8dde3; --ink: #1c232b;
  --muted: #5c6773; --accent: #0f766e; --accent-soft: #e6f4f1; --accent-soft-border: #bfe3dd;
  --danger: #b3402f; --danger-bg: #fbeae7; --danger-border: #f0c9c2; --amber: #9a6b12;
  --amber-bg: #fbf1de; --shadow: 0 1px 2px rgba(20, 28, 36, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
  max-width: 40vw;
}

.user-info .name,
.user-info .tenant {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-info .name {
  font-size: 13.5px;
  font-weight: 600;
}

.user-info .tenant {
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .user-info .tenant {
    display: none;
  }
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.container.wide {
  max-width: 1040px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

@media (max-width: 640px) {
  .container {
    padding: 20px 14px 48px;
  }

  .card {
    padding: 16px 16px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .field-row {
    flex-direction: column;
    gap: 14px;
  }
}

.card + .card {
  margin-top: 20px;
}

h1 {
  font-size: 24px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 15.5px;
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}

h2 + p.hint {
  margin-top: 4px;
}

p.hint {
  color: var(--muted);
  font-size: 13.5px;
  margin: 4px 0 18px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  margin-top: 14px;
}

label:first-of-type {
  margin-top: 0;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="datetime-local"],
select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row > div {
  flex: 1;
}

button {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  margin-top: 18px;
}

button:hover {
  opacity: 0.92;
}

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

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

button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

button.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
  margin-top: 0;
  padding: 5px 10px;
  font-size: 12.5px;
}

button.small {
  margin-top: 0;
  padding: 5px 10px;
  font-size: 12.5px;
}

.key-box {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  word-break: break-all;
  margin-top: 6px;
}

.banner {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.banner.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.banner.success {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-soft-border);
}

/* ---- tabs (index.html: Log in / Create tenant / Use API key) ---- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px 4px;
  margin: 0 12px 0 0;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}

.tab:hover {
  color: var(--ink);
  opacity: 1;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ---- stat tiles (dashboard summary row) ---- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.stat-tile .value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat-tile .label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -24px;
  padding: 0 24px;
}

@media (max-width: 640px) {
  .table-scroll {
    margin: 0 -16px;
    padding: 0 16px;
  }
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

td.code {
  font-family: var(--mono);
}

td.long-url {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

td.num {
  font-family: var(--mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.actions {
  white-space: nowrap;
}

td.actions button {
  margin-right: 6px;
}

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.pill.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill.disabled {
  background: var(--surface-2);
  color: var(--muted);
}

.pill.role-owner {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill.role-member {
  background: var(--surface-2);
  color: var(--muted);
}

.pill.unassigned {
  background: var(--amber-bg);
  color: var(--amber);
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 28px 0;
  text-align: center;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.session-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.session-row input {
  flex: 1;
  min-width: 160px;
}

.inline-panel {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.inline-panel dt {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  margin-top: 8px;
}

.inline-panel dt:first-child {
  margin-top: 0;
}

.inline-panel dd {
  margin: 2px 0 0;
  font-family: var(--mono);
}

.inline-panel label {
  margin-top: 10px;
}

.inline-panel button {
  margin-top: 14px;
  margin-right: 8px;
}

a.link-out {
  color: var(--accent);
}

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

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 13.5px;
}

.user-list .username {
  font-family: var(--mono);
  font-weight: 600;
}

.bulk-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
}

.bulk-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.bulk-result-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  font-size: 13px;
}

.bulk-result-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.bulk-result-list li:last-child {
  border-bottom: none;
}

.search-row {
  margin-bottom: 16px;
}

.pagination-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.page-info {
  font-size: 13px;
}

.qr-preview {
  margin-top: 8px;
}

.qr-preview img {
  max-width: 180px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 8px;
}
