/* === OZ.tools Design System v2 === */

/* --- Font faces --- */
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/Inter-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens --- */
:root {
  --ds-bg-page: #F5F5F5;
  --ds-bg-card: #FFFFFF;
  --ds-brand: #424242;
  --ds-brand-financial: #4f8cff;
  --ds-tier-pro: #7E57C2;
  --ds-text-secondary: #666666;
  --ds-text-muted: #999999;
  --ds-border: #E0E0E0;
  --ds-success: #2E7D32;
  --ds-error: #C62828;
  --ds-warning: #F9A825;
  --ds-radius: 8px;
  --ds-radius-lg: 12px;
  --ds-font: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* --- Reset + Base --- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  font-family: var(--ds-font);
  margin: 0;
  background: var(--ds-bg-page);
  color: var(--ds-brand);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--ds-brand-financial); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 8px; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 12px; }
h3 { font-size: 15px; font-weight: 600; margin: 16px 0 8px; }

/* --- Layout --- */
.ds-wrap {
  max-width: 480px;
  margin: 40px auto;
  padding: 32px;
  background: var(--ds-bg-card);
  border-radius: var(--ds-radius-lg);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.ds-wrap-wide { max-width: 720px; }
.ds-wrap-full {
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

/* --- Header --- */
.ds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 48px;
  background: var(--ds-bg-card);
  border-bottom: 1px solid var(--ds-border);
}
.ds-header-logo {
  font-weight: 700;
  color: var(--ds-brand);
  font-size: 15px;
  text-decoration: none;
}
.ds-header-logo:hover { text-decoration: none; }
.ds-header-logo span {
  font-weight: 400;
  color: var(--ds-text-muted);
}
.ds-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ds-header-separator {
  color: var(--ds-text-muted);
  font-weight: 400;
}
.ds-header-service {
  color: var(--ds-text-secondary);
  font-weight: 400;
  font-size: 15px;
  max-width: 32ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-header-service-link {
  color: var(--ds-brand-financial);
  text-decoration: none;
}
.ds-header-service-link:hover { text-decoration: underline; }
.ds-header-breadcrumb-current { color: var(--ds-text-primary); font-weight: 500; }
.ds-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ds-header-email {
  color: var(--ds-text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.ds-header-link {
  color: var(--ds-brand-financial);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.ds-header-link:hover { text-decoration: underline; }
#oz-header { min-height: 48px; }

/* --- Navigation --- */
.ds-nav {
  display: flex;
  gap: 0;
  background: var(--ds-bg-card);
  border-bottom: 1px solid var(--ds-border);
  padding: 0 24px;
}
.ds-nav-link {
  color: var(--ds-text-secondary);
  text-decoration: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.ds-nav-link:hover {
  color: var(--ds-brand);
  text-decoration: none;
}
.ds-nav-link.active {
  color: var(--ds-brand);
  border-bottom-color: var(--ds-brand);
}
.ds-nav-admin {
  margin-left: auto;
  color: var(--ds-warning);
}

/* --- Buttons --- */
.ds-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--ds-radius);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--ds-font);
  cursor: pointer;
  border: none;
  text-decoration: none;
  text-align: center;
  line-height: 1.4;
  transition: background 0.15s;
}
.ds-btn:hover { text-decoration: none; }
.ds-btn:disabled,
.ds-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.ds-btn-primary {
  background: var(--ds-brand-financial);
  color: #fff;
}
.ds-btn-primary:hover { background: #3d7ae6; }
.ds-btn-dark {
  background: var(--ds-brand);
  color: #fff;
}
.ds-btn-dark:hover { background: #333; }
.ds-btn-secondary {
  background: transparent;
  color: var(--ds-brand);
  border: 1px solid var(--ds-border);
}
.ds-btn-secondary:hover { background: #f5f5f5; }
.ds-btn-success {
  background: var(--ds-success);
  color: #fff;
}
.ds-btn-danger {
  background: var(--ds-error);
  color: #fff;
}
.ds-btn-muted {
  background: var(--ds-text-secondary);
  color: #fff;
}
.ds-btn-sm { padding: 6px 12px; font-size: 13px; }
.ds-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Inputs --- */
.ds-input, .ds-select, .ds-textarea {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--ds-font);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius);
  background: var(--ds-bg-card);
  color: var(--ds-brand);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ds-input:focus, .ds-select:focus, .ds-textarea:focus {
  border-color: var(--ds-brand-financial);
  box-shadow: 0 0 0 3px rgba(79,140,255,0.1);
}
.ds-input[readonly], .ds-input:disabled,
.ds-select:disabled, .ds-textarea[readonly], .ds-textarea:disabled {
  background: var(--ds-bg-soft, #f5f5f5);
  color: var(--ds-text-secondary);
  cursor: not-allowed;
}
.ds-input[readonly]:focus, .ds-textarea[readonly]:focus {
  border-color: var(--ds-border);
  box-shadow: none;
}
.ds-textarea { resize: vertical; }
.ds-label {
  display: block;
  margin: 12px 0;
  font-size: 14px;
  font-weight: 500;
}
.ds-label > .ds-input,
.ds-label > .ds-select,
.ds-label > .ds-textarea {
  margin-top: 4px;
}

/* --- Cards --- */
.ds-card {
  background: var(--ds-bg-card);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 24px;
}

/* --- Badges (tier) --- */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.ds-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.ds-badge-free { background: #E8F5E9; color: var(--ds-success); }
.ds-badge-start { background: #E3F2FD; color: var(--ds-brand-financial); }
.ds-badge-pro { background: #EDE7F6; color: var(--ds-tier-pro); }

/* --- Status pills --- */
.ds-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.ds-status-new { background: #FFF8E1; color: #F57F17; }
.ds-status-approved { background: #E8F5E9; color: var(--ds-success); }
.ds-status-rejected { background: #FFEBEE; color: var(--ds-error); }

/* --- Company sections (page /company) --- */
.company-section {
  background: var(--ds-bg-card);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.company-section > h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
}
.company-section > .section-hint {
  margin: 0 0 16px 0;
  font-size: 14px;
  color: var(--ds-text-muted);
}
.company-section > .section-hint:last-child {
  margin-bottom: 0;
}
.company-section--danger {
  background: transparent;
  border: 1px dashed var(--ds-border);
}

.member-row,
.invitation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ds-border);
}
.member-row:last-child,
.invitation-row:last-child { border-bottom: none; }
.member-email,
.invitation-email {
  flex: 1 1 auto;
  font-weight: 500;
}
.member-role,
.invitation-role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--ds-bg-page);
  font-size: 12px;
  color: var(--ds-text-secondary);
}
.member-actions,
.invitation-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.audit-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ds-border);
  font-size: 13px;
}
.audit-item:last-child { border-bottom: none; }
.audit-ts {
  color: var(--ds-text-muted);
  white-space: nowrap;
}

/* --- Wallets --- */
.ds-wallets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}
.ds-wallet {
  background: var(--ds-bg-page);
  border-radius: var(--ds-radius);
  padding: 14px;
  text-align: center;
}
.ds-wallet-total {
  background: var(--ds-brand);
  color: #fff;
}
.ds-wallet-label {
  display: block;
  font-size: 11px;
  color: var(--ds-text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ds-wallet-total .ds-wallet-label { color: rgba(255,255,255,0.7); }
.ds-wallet-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
}

/* --- Tables --- */
.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}
.ds-table th {
  text-align: left;
  padding: 8px;
  border-bottom: 2px solid var(--ds-border);
  color: var(--ds-text-secondary);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ds-table td {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
}
.ds-table tbody tr:hover { background: #fafafa; }

/* --- Tariff cards --- */
.ds-tariffs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 16px 0;
}
.ds-tariff-card {
  background: var(--ds-bg-page);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  padding: 24px;
  text-align: center;
}
.ds-tariff-card.featured {
  border-color: var(--ds-tier-pro);
  border-width: 2px;
}
.ds-tariff-price {
  font-size: 20px;
  font-weight: 600;
  margin: 8px 0;
}

/* --- Payment methods --- */
.ds-payment-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 12px 0;
}
.ds-method-card {
  background: var(--ds-bg-page);
  border-radius: var(--ds-radius);
  padding: 16px;
}
.ds-method-card h4 { margin: 0 0 4px; font-size: 14px; }
.ds-method-card p { margin: 0; font-size: 13px; color: var(--ds-text-secondary); }

/* --- Pagination --- */
.ds-pagination { display: flex; gap: 8px; margin: 12px 0; }

/* --- Utility --- */
.ds-hint { color: var(--ds-text-secondary); font-size: 13px; }
.ds-error,
.error-text { color: var(--ds-error); font-size: 14px; }

/* --- Toast --- */
.ds-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ds-toast.ds-toast--show { opacity: 1; }
.ds-toast--success { background: #16a34a; color: #fff; }
.ds-toast--error { background: var(--ds-error); color: #fff; }
.ds-positive { color: var(--ds-success); }
.ds-negative { color: var(--ds-error); }
.ds-text-muted { color: var(--ds-text-muted); }
.ds-text-center { text-align: center; }
.ds-mt-1 { margin-top: 8px; }
.ds-mt-2 { margin-top: 16px; }
.ds-mt-3 { margin-top: 24px; }
.ds-mt-4 { margin-top: 32px; }
.ds-mb-1 { margin-bottom: 8px; }
.ds-mb-2 { margin-bottom: 16px; }

/* --- Modal overlay --- */
.ds-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}
.ds-modal-overlay:not([hidden]),
.ds-modal-overlay.is-open {
  display: flex;
}
.ds-modal-overlay.hidden { display: none; }
body.modal-open { overflow: hidden; }

/* Generic visibility helper used by templates without their own state CSS */
.hidden { display: none !important; }

/* --- Form / vertical stack helper ---
 * Use on any container where children should sit vertically with breathing
 * room: forms with input + button, blocks of label+input pairs, modal bodies.
 * `.ds-stack > .ds-input, .ds-stack > .ds-select` get `width: 100%` so that
 * inputs span the container width consistently. */
.ds-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.ds-stack > .ds-input,
.ds-stack > .ds-select,
.ds-stack > .ds-textarea {
  width: 100%;
}
.ds-stack > .ds-btn {
  align-self: flex-start;
}
.ds-stack-tight { gap: 8px; }
.ds-stack-loose { gap: 20px; }

/* --- Form field (label + input/select stack) ---
 * Use as a wrapper around a label + input pair when the form is laid out as
 * blocks rather than inline (.ds-label). Pair with .ds-stack on the parent
 * <form> to get consistent spacing between fields. */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ds-field > label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ds-text-secondary);
}
.ds-field > .ds-input,
.ds-field > .ds-select,
.ds-field > .ds-textarea {
  width: 100%;
}

.ds-modal {
  position: relative;
  background: var(--ds-bg-card);
  border-radius: var(--ds-radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: ds-modal-pop 120ms ease-out;
}
.ds-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  color: var(--ds-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ds-modal-close:hover {
  background: var(--ds-bg-page);
  color: var(--ds-text);
}
@keyframes ds-modal-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .ds-wallets { grid-template-columns: repeat(2, 1fr); }
  .ds-tariffs { grid-template-columns: 1fr; }
  .ds-payment-methods { grid-template-columns: 1fr; }
  .ds-modal-overlay { padding: 0; align-items: flex-end; }
  .ds-modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--ds-radius-lg) var(--ds-radius-lg) 0 0;
    padding: 20px;
  }
}

.ds-modal--wide {
  max-width: 1200px;
  min-height: 600px;
  padding: 24px;
}

.ds-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 600px) {
  .ds-modal-grid {
    grid-template-columns: 1fr;
  }
}
