/* hutko.рахунок — design tokens & styles */
:root {
  --color-accent: #e40b2d;
  --color-accent-hover: #af0821;
  --color-accent-light: #feecee;
  --color-bg: #ffffff;
  --color-surface: #f5f7f8;
  --color-border: #e5e5e5;
  --color-text: #202121;
  --color-text-muted: #4f4e50;
  --color-error: #d93025;
  --color-error-bg: #fef2f0;
  --color-success: #1a7a4a;
  --color-success-bg: #edfaf3;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 2px 12px rgba(228, 11, 45, 0.10);
  --shadow-btn: 0 4px 16px rgba(228, 11, 45, 0.25);
  --font-family: 'Robochyi Sans', system-ui, -apple-system, sans-serif;
  --transition: 0.18s ease;
}

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

/* Author display rules (flex/grid) otherwise win over the UA [hidden] default. */
[hidden] { display: none !important; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.rk-header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--color-border);
}

.rk-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  align-items: baseline;
  gap: 0;
}
.rk-logo-hutko { color: var(--color-accent); }
.rk-logo-suffix { color: var(--color-text); }

.rk-header-auth {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rk-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.rk-user-email { font-weight: 500; color: var(--color-text); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.rk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  padding: 10px 20px;
  white-space: nowrap;
  text-decoration: none;
}

.rk-btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.rk-btn-primary {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-btn);
}
.rk-btn-primary:hover { background: var(--color-accent-hover); transform: translateY(-1px); }
.rk-btn-primary:active { transform: translateY(0); }
.rk-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.rk-btn-secondary {
  background: var(--color-surface);
  color: var(--color-accent);
  border: 1.5px solid var(--color-border);
}
.rk-btn-secondary:hover { background: var(--color-accent-light); }

.rk-btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  padding: 8px 14px;
  font-size: 0.875rem;
}
.rk-btn-ghost:hover { color: var(--color-text); background: var(--color-surface); }

.rk-btn-wide { width: 100%; padding: 16px 24px; font-size: 1.0625rem; }

/* ── Hero / tagline ───────────────────────────────────────────────────────── */
.rk-hero {
  text-align: center;
  padding: 40px 24px 24px;
}
.rk-hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-muted);
  letter-spacing: -0.01em;
}
.rk-hero h1 span { color: var(--color-accent); }

/* ── Main layout ──────────────────────────────────────────────────────────── */
.rk-main {
  flex: 1;
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
  padding: 0 24px 48px;
}

.rk-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.rk-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.rk-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.rk-card-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.rk-form { display: flex; flex-direction: column; gap: 20px; }

.rk-field { display: flex; flex-direction: column; gap: 6px; }

.rk-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}
.rk-label-required::after {
  content: " *";
  color: var(--color-error);
}

.rk-input, .rk-textarea {
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.rk-input:focus, .rk-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(228, 11, 45, 0.12);
}
.rk-input.rk-invalid, .rk-textarea.rk-invalid {
  border-color: var(--color-error);
  background: var(--color-error-bg);
}
.rk-input.rk-field-flash, .rk-textarea.rk-field-flash {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  transition: background-color 0.9s ease, border-color 0.9s ease;
}
.rk-textarea { resize: vertical; min-height: 100px; }

.rk-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.rk-error {
  font-size: 0.8rem;
  color: var(--color-error);
  display: none;
}
.rk-error.rk-visible { display: block; }

.rk-server-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

/* ── Amount toggle ────────────────────────────────────────────────────────── */
.rk-toggle-group {
  display: flex;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.rk-toggle-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  color: var(--color-text-muted);
  user-select: none;
}
.rk-toggle-option input { display: none; }
.rk-toggle-option.rk-active {
  background: var(--color-accent);
  color: #fff;
}

/* ── Auth block ───────────────────────────────────────────────────────────── */
.rk-auth-block {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}
.rk-auth-block p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.rk-auth-block strong { color: var(--color-text); }

.rk-auth-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── History ──────────────────────────────────────────────────────────────── */
.rk-history { margin-bottom: 24px; }
.rk-history-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rk-history-list { display: flex; flex-direction: column; gap: 8px; }
.rk-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--color-accent-light);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.875rem;
}
.rk-history-item:hover { background: #fdd8de; }
.rk-history-item-name { font-weight: 600; color: var(--color-text); }
.rk-history-item-sub { color: var(--color-text-muted); font-size: 0.8rem; }
.rk-history-arrow { color: var(--color-accent); font-size: 1.1rem; }

/* ── Result ───────────────────────────────────────────────────────────────── */
.rk-result {
  display: none;
  margin-top: 20px;
  background: var(--color-success-bg);
  border: 1.5px solid #b0e8cc;
  border-radius: var(--radius-md);
  padding: 20px;
}
.rk-result.rk-visible { display: block; }
.rk-result-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-success);
  margin-bottom: 12px;
}
.rk-result-link-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.rk-result-link {
  flex: 1;
  background: var(--color-bg);
  border: 1.5px solid #b0e8cc;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: monospace;
  color: var(--color-accent);
  word-break: break-all;
}

/* ── Preview (phone mockup) ───────────────────────────────────────────────── */
.rk-preview-col { position: sticky; top: 80px; }

.rk-preview-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  margin-bottom: 16px;
}

.rk-phone {
  max-width: 280px;
  margin: 0 auto;
  background: #202121;
  border-radius: 36px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(32, 33, 33, 0.25);
}
.rk-phone-screen {
  background: var(--color-bg);
  border-radius: 26px;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}
.rk-phone-bar {
  background: var(--color-accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  text-align: center;
  padding: 8px 12px;
  letter-spacing: 0.05em;
}
.rk-phone-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rk-pv-company {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
  word-break: break-word;
}
.rk-pv-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rk-pv-label { font-size: 0.625rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rk-pv-value { font-size: 0.75rem; color: var(--color-text); font-weight: 500; word-break: break-all; }
.rk-pv-amount {
  background: var(--color-accent-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
  margin-top: 4px;
}
.rk-pv-amount-label { font-size: 0.625rem; color: var(--color-text-muted); text-transform: uppercase; }
.rk-pv-amount-value { font-size: 1.25rem; font-weight: 700; color: var(--color-accent); }
.rk-pv-amount-input {
  display: none;
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.875rem;
  text-align: center;
  background: var(--color-surface);
  color: var(--color-text);
}
.rk-pv-btn {
  margin-top: auto;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.875rem;
  font-weight: 700;
  width: 100%;
  cursor: default;
}
.rk-pv-placeholder {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-align: center;
  margin: auto;
  padding: 24px;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.rk-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: rk-spin 0.7s linear infinite;
  display: none;
}
.rk-btn-primary.rk-loading .rk-spinner { display: inline-block; }
.rk-btn-primary.rk-loading .rk-btn-label { display: none; }

@keyframes rk-spin { to { transform: rotate(360deg); } }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.rk-footer {
  text-align: center;
  padding: 20px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}
.rk-footer a { color: var(--color-accent); text-decoration: none; }

/* ── Pay page ─────────────────────────────────────────────────────────────── */
.rk-pay-main { max-width: 480px; margin: 32px auto; padding: 0 24px 48px; }
.rk-pay-card { border-radius: var(--radius-lg); }
.rk-pay-company { font-size: 1.25rem; font-weight: 700; margin-bottom: 4px; }
.rk-pay-company-label { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 2px; }
.rk-pay-checkout-btn { margin-bottom: 16px; }
.rk-pay-meta { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.rk-pay-field { display: flex; flex-direction: column; gap: 2px; }
.rk-pay-field-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rk-pay-field-value { font-size: 0.9375rem; font-weight: 500; word-break: break-all; }
.rk-pay-amount-block {
  background: var(--color-accent-light);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  margin-bottom: 24px;
}
.rk-pay-amount-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rk-pay-amount-value { font-size: 2rem; font-weight: 700; color: var(--color-accent); }
.rk-pay-amount-input {
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  margin-top: 8px;
}
.rk-pay-amount-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(228,11,45,0.12);
}
#checkout-container { margin-top: 8px; }

/* ── 404 page ─────────────────────────────────────────────────────────────── */
.rk-404 { text-align: center; padding: 80px 24px; }
.rk-404 h1 { font-size: 4rem; color: var(--color-accent); font-weight: 900; }
.rk-404 p { color: var(--color-text-muted); margin: 16px 0 24px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .rk-layout { grid-template-columns: 1fr; }
  .rk-preview-col { display: none; }
}

@media (max-width: 600px) {
  .rk-card { padding: 20px; }
  .rk-hero { padding: 24px 16px 16px; }
  .rk-main { padding: 0 12px 32px; }
}
