/* src/web/styles.css */
:root {
  --bg: #14161a;
  --panel: #1c1f25;
  --panel-soft: #23262d;
  --border: #31353d;
  --text: #e6e8ec;
  --muted: #969ba5;
  --accent: #eba452;
  --accent2: color-mix(in oklab, var(--accent), transparent 60%);
  --danger: #ff6b6b;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--panel);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--accent2);
  background-clip: content-box;
  border: 1px solid #0000;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: content-box;
}

::-webkit-scrollbar-corner {
  background: none;
}

body {
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-family: Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
  font-size: 14px;
}

button {
  font: inherit;
  color: inherit;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 6px 12px;
}

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

button:disabled {
  opacity: .5;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1220;
  font-weight: 600;
}

button.link {
  color: var(--muted);
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}

input[type="text"], input[type="number"], input[type="password"] {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  padding: 7px 10px;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: var(--accent);
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

label {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
  font-size: 12px;
}

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

header {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  flex-start;
  gap: 24px;
  padding-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 20px;
}

.subtitle {
  color: var(--muted);
  margin: 4px 0 0;
}

.status {
  display: flex;
  color: var(--muted);
  flex-wrap: wrap;
  align-items:  center;
  gap: 16px;
  font-size: 12px;
}

.error {
  color: var(--danger);
}

.banner {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: #ff6b6b1a;
  margin: 16px 0 0;
  padding: 10px 12px;
}

.controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1.2fr;
  align-items:  start;
  gap: 20px;
  margin-top: 20px;
}

@media (width <= 900px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

.picker, .filter, .radius {
  position: relative;
}

.picker-selected {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 8px 0 0;
}

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

.picker-results, .filter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.picker-results {
  position: absolute;
  z-index: 20;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 320px;
  margin-top: 4px;
  top: 100%;
  left: 0;
  right: 0;
}

.picker-results button {
  display: flex;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  padding: 8px 10px;
}

.picker-results button:hover {
  background: var(--panel-soft);
}

.picker-more {
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
}

.picker-meta, .filter-count {
  color: var(--muted);
  white-space: nowrap;
  font-size: 12px;
}

.filter-toggle {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  width: 100%;
}

.filter-caret {
  color: var(--muted);
  font-size: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.chip {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}

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

.filter-panel {
  position: absolute;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  padding: 10px;
  top: 100%;
  left: 0;
  right: 0;
}

.filter-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.filter-presets button {
  padding: 4px 10px;
  font-size: 12px;
}

.filter-list {
  overflow-y: auto;
  max-height: 280px;
  margin-top: 8px;
}

.filter-list label {
  display: flex;
  color: var(--text);
  cursor: pointer;
  align-items:  center;
  gap: 8px;
  margin: 0;
  padding: 4px 2px;
  font-size: 13px;
}

.filter-name {
  flex: 1;
}

.radius-input {
  display: flex;
  align-items:  center;
  gap: 8px;
}

.radius-input span {
  color: var(--muted);
}

.radius-slider {
  accent-color: var(--accent);
  width: 100%;
  margin-top: 10px;
}

.radius-steps {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.radius-steps button {
  flex: 1;
  padding: 3px 0;
  font-size: 12px;
}

.radius-steps button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.options {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  center;
  gap: 16px;
  margin-top: 20px;
}

.options label {
  display: flex;
  color: var(--text);
  cursor: pointer;
  align-items:  center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

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

.export {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  justify-content: space-between;
  align-items:  center;
  gap: 16px;
  margin-top: 20px;
  padding: 12px 14px;
}

.export-count em {
  color: var(--danger);
  font-style: normal;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items:  center;
  gap: 8px;
}

.schema {
  display: flex;
}

.schema button {
  border-radius: 0;
  padding: 6px 10px;
  font-size: 12px;
}

.schema button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.schema button:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-left: -1px;
}

.schema button.active {
  border-color: var(--accent);
  color: var(--accent);
  z-index: 1;
}

.schema-fields {
  display: flex;
  gap: 6px;
}

.schema-fields input {
  width: 110px;
}

.hint {
  color: var(--muted);
  margin: 16px 0 0;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

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

th, td {
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  padding: 6px 10px;
}

th {
  position: sticky;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  top: 0;
}

tbody tr:hover {
  background: var(--panel);
}

tr.is-org td {
  color: var(--muted);
  font-style: italic;
}

.right {
  text-align: right;
}

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  margin-top: 32px;
  padding-top: 12px;
  font-size: 12px;
}

footer a {
  color: var(--muted);
}

footer a:hover {
  color: var(--accent);
}

.login {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-direction: column;
  gap: 12px;
  max-width: 320px;
  margin: 12vh auto 0;
  padding: 24px;
}

.login h1 {
  margin: 0;
}

.login .subtitle {
  margin: 0 0 4px;
}

.login button {
  margin-top: 4px;
}

.logout {
  color: var(--muted);
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
}

.logout:hover {
  color: var(--accent);
}
