:root {
  --bg: #F5F4F0;
  --card: #FFFFFF;
  --card-hover: #FAFAF7;
  --border: rgba(28, 25, 23, 0.08);
  --border-strong: rgba(28, 25, 23, 0.14);
  --text: #1C1917;
  --text-muted: #78716C;
  --text-subtle: #A8A29E;
  --accent: #FF3D57;
  --accent-hover: #E63047;
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;
  --shadow-sm: 0 1px 4px rgba(28, 25, 23, 0.08);
  --shadow-md: 0 4px 16px rgba(28, 25, 23, 0.08);
  --ring: 0 0 0 1px rgba(28, 25, 23, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Heebo", "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #FF6B8A 100%);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 22px; font-weight: 800;
}
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.stats { display: flex; gap: 10px; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  display: flex; flex-direction: column; align-items: center;
  min-width: 92px;
}
.stat-value { font-size: 18px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
}

.sidebar {
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 22px 18px;
  overflow-y: auto;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.sidebar-header h2 { font-size: 15px; font-weight: 700; }
.sidebar-note { font-size: 11px; color: var(--text-subtle); margin-bottom: 14px; }

.client-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.client-empty {
  color: var(--text-subtle);
  font-size: 12px;
  padding: 18px 12px;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.client-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  border: 1px solid transparent;
  background: var(--card-hover);
  transition: all 0.12s ease;
}
.client-item:hover { border-color: var(--border-strong); }
.client-item.active {
  background: #FFF;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm), var(--ring);
}
.client-item-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-item-sub { font-size: 10.5px; color: var(--text-muted); }

.main-panel {
  padding: 24px 32px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.hidden { display: none !important; }

.client-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), var(--ring);
}
.client-bar-info { flex: 1; min-width: 0; }
.client-bar-info h2 { font-size: 18px; font-weight: 800; margin-bottom: 2px; }
.client-bar-meta { font-size: 12px; color: var(--text-muted); }

.drop-zone {
  background: var(--card);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 22px;
  text-align: center;
  cursor: pointer;
  transition: all 0.16s ease;
}
.drop-zone:hover, .drop-zone.dragover {
  background: var(--card-hover);
  border-color: var(--accent);
}
.drop-zone.compact {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: right;
  padding: 20px 26px;
}
.drop-icon {
  font-size: 32px;
  color: var(--accent);
  font-weight: 300;
  line-height: 1;
  flex-shrink: 0;
}
.drop-zone.compact .drop-text { flex: 1; min-width: 0; }
.drop-title { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.drop-subtitle { font-size: 12px; color: var(--text-muted); }

.log-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm), var(--ring);
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.log-header h3 { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

.log-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.log-empty {
  color: var(--text-subtle);
  font-size: 12px;
  padding: 24px 14px;
  text-align: center;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.log-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.12s ease;
}
.log-row:hover { border-color: var(--border-strong); background: var(--card-hover); }
.log-row-main { flex: 1; min-width: 0; }
.log-row-name {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.log-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.log-row-meta .dot { opacity: 0.5; }
.row-warn {
  display: inline-block;
  margin-right: 4px;
  cursor: help;
}
.row-new {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 700;
  border: 1px solid #F59E0B;
}
.log-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease;
  font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; padding: 14px 24px; }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { background: var(--card-hover); }

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}
.btn-link:hover { color: var(--accent); }

.btn-small {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 11.5px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  font-family: inherit;
  white-space: nowrap;
}
.btn-small:hover { background: var(--card); }
.btn-small.btn-v2 { background: var(--accent); color: white; border-color: var(--accent); }
.btn-small.btn-v2:hover { background: var(--accent-hover); }
.btn-small.danger { color: var(--danger); border-color: rgba(220, 38, 38, 0.3); }
.btn-small.danger:hover { background: #FEE2E2; }

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 0;
  font-family: inherit;
}
.btn-icon:hover { color: var(--danger); background: #FEE2E2; border-color: rgba(220, 38, 38, 0.3); }

.usage-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  box-shadow: var(--shadow-sm), var(--ring);
}
.usage-section h3 { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 14px; }
.usage-steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.usage-steps li {
  counter-increment: step;
  padding-right: 42px;
  position: relative;
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}
.usage-steps li::before {
  content: counter(step);
  position: absolute;
  right: 0; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}
.usage-steps li strong { display: block; font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.usage-steps li span { color: var(--text-muted); font-size: 12.5px; }
.usage-steps em { color: var(--accent); font-style: normal; font-weight: 700; }

.responsibility-notice {
  background: linear-gradient(135deg, #FEF9E7 0%, #FEF3C7 100%);
  border: 1.5px solid #F59E0B;
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.responsibility-icon { font-size: 26px; line-height: 1; flex-shrink: 0; margin-top: 2px; }
.responsibility-body { flex: 1; min-width: 0; }
.responsibility-title {
  font-size: 14px;
  font-weight: 800;
  color: #78350F;
  margin-bottom: 8px;
}
.responsibility-body p {
  font-size: 12.5px;
  color: #78350F;
  line-height: 1.65;
  margin-bottom: 6px;
}
.responsibility-body p:last-child { margin-bottom: 0; }
.responsibility-body a {
  color: #78350F;
  text-decoration: underline;
  font-weight: 700;
}

.footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 14px 28px;
}
.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 12px;
  color: var(--text-muted);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  font-weight: 600;
}
.footer-links a:hover { color: var(--text); text-decoration: underline; }

.modal {
  position: fixed; inset: 0;
  background: rgba(28, 25, 23, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-content {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal-content h3 { margin-bottom: 16px; font-size: 20px; font-weight: 800; }

.field-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 700; }
.text-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  margin-bottom: 16px;
}
.text-input:focus { outline: none; border-color: var(--accent); }

.terms-box { font-size: 13px; color: var(--text); margin-bottom: 18px; }
.terms-box p { margin-bottom: 10px; }
.terms-box ul { padding-right: 22px; padding-left: 8px; margin-bottom: 12px; }
.terms-box li { margin-bottom: 6px; }
.terms-box a { color: var(--accent); font-weight: 600; }
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text);
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  cursor: pointer;
  line-height: 1.55;
}
.checkbox-label input { margin-top: 3px; flex-shrink: 0; }
.modal-actions { display: flex; gap: 8px; }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  z-index: 200;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.legal-page { max-width: 760px; margin: 40px auto; padding: 0 24px; font-size: 14px; }
.legal-page h2 { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.legal-page h3 { font-size: 16px; font-weight: 700; margin: 26px 0 10px; color: var(--text); }
.legal-page p { margin-bottom: 12px; color: var(--text); line-height: 1.75; }
.legal-page ul, .legal-page ol { padding-right: 24px; margin-bottom: 12px; }
.legal-page li { margin-bottom: 6px; line-height: 1.65; }
.legal-page a { color: var(--accent); text-decoration: underline; font-weight: 600; }
.legal-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 24px; }
.privacy-highlight {
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #065F46;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .topbar { flex-direction: column; gap: 12px; align-items: flex-start; padding: 14px 20px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-left: none; border-bottom: 1px solid var(--border); max-height: 220px; }
  .main-panel { padding: 18px; }
  .drop-zone.compact { flex-direction: column; text-align: center; }
  .drop-zone.compact .drop-text { text-align: center; }
  .log-row { flex-direction: column; align-items: stretch; }
  .log-row-actions { justify-content: stretch; }
  .log-row-actions .btn-small { flex: 1; }
  .footer-content { flex-direction: column; gap: 8px; text-align: center; }
}
