/* Woptio CRM */
:root {
  --wo-primary: #4f46e5;
  --wo-primary-soft: color-mix(in srgb, var(--wo-primary) 12%, transparent);
  --wo-bg: #f5f6fa;
  --wo-surface: #ffffff;
  --wo-surface-2: #f0f1f6;
  --wo-border: #e4e6ee;
  --wo-text: #1c1f2b;
  --wo-muted: #6b7084;
  --wo-ok: #15803d;
  --wo-ok-soft: #dcfce7;
  --wo-warn: #b45309;
  --wo-warn-soft: #fef3c7;
  --wo-err: #b91c1c;
  --wo-err-soft: #fee2e2;
  --wo-radius: 12px;
  --wo-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --wo-sidebar: 256px;
  --wo-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", "Helvetica Neue", Arial, sans-serif;
}
html.wo-dark {
  --wo-bg: #0f1117;
  --wo-surface: #181b24;
  --wo-surface-2: #222632;
  --wo-border: #2b2f3c;
  --wo-text: #e7e9f0;
  --wo-muted: #9aa0b4;
  --wo-ok-soft: #12321f;
  --wo-warn-soft: #3a2a0c;
  --wo-err-soft: #3b1414;
  --wo-primary-soft: color-mix(in srgb, var(--wo-primary) 22%, transparent);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--wo-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--wo-text);
  background: var(--wo-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--wo-primary); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.wo-icon { flex-shrink: 0; display: block; }
.wo-muted { color: var(--wo-muted); }
.wo-center { text-align: center; }
[hidden] { display: none !important; }

/* Buttons */
.wo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: filter .15s, background .15s;
}
.wo-btn-primary { background: var(--wo-primary); color: #fff; }
.wo-btn-primary:hover { filter: brightness(1.08); }
.wo-btn-light { background: var(--wo-surface-2); color: var(--wo-text); border-color: var(--wo-border); }
.wo-btn-light:hover { background: var(--wo-border); }
.wo-btn-danger-light { background: var(--wo-err-soft); color: var(--wo-err); }
.wo-btn-block { width: 100%; }
.wo-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent;
  color: var(--wo-muted); cursor: pointer;
}
.wo-icon-btn:hover { background: var(--wo-surface-2); color: var(--wo-text); }

/* Forms */
.wo-form { display: flex; flex-direction: column; gap: 16px; }
.wo-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.wo-field > span:first-child { font-weight: 600; }
.wo-field input[type=text], .wo-field input[type=password], .wo-field input[type=email],
.wo-field input[type=number], .wo-field select, .wo-field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--wo-border); background: var(--wo-surface); color: var(--wo-text);
  font: inherit; font-size: 16px; /* 16px stops iOS zoom */
}
.wo-field input:focus, .wo-field select:focus, .wo-field textarea:focus {
  outline: none; border-color: var(--wo-primary); box-shadow: 0 0 0 3px var(--wo-primary-soft);
}
.wo-field input[type=color] { width: 64px; height: 44px; padding: 4px; border-radius: 10px; border: 1px solid var(--wo-border); background: var(--wo-surface); }
.wo-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.wo-check input { width: 18px; height: 18px; accent-color: var(--wo-primary); }
.wo-password { position: relative; display: block; }
.wo-password input { padding-right: 64px !important; }
.wo-password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--wo-primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 8px;
}
.wo-form-actions { display: flex; justify-content: flex-end; }
.wo-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Alerts and badges */
.wo-alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.wo-alert-error { background: var(--wo-err-soft); color: var(--wo-err); }
.wo-alert-ok { background: var(--wo-ok-soft); color: var(--wo-ok); }
.wo-badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--wo-surface-2); color: var(--wo-muted); white-space: nowrap;
}
.wo-badge-ok { background: var(--wo-ok-soft); color: var(--wo-ok); }
.wo-badge-soon { background: var(--wo-warn-soft); color: var(--wo-warn); }

/* Logo mark */
.wo-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; background: var(--wo-primary); color: #fff;
  font-weight: 800; font-size: 18px; text-transform: uppercase;
}
.wo-logo-mark-lg { width: 56px; height: 56px; border-radius: 16px; font-size: 28px; }

/* Login */
.wo-login-page { background: radial-gradient(1200px 600px at 50% -10%, var(--wo-primary-soft), transparent), var(--wo-bg); }
.wo-login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.wo-login-card {
  width: 100%; max-width: 400px; background: var(--wo-surface); border: 1px solid var(--wo-border);
  border-radius: 20px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(16, 24, 40, .08);
}
.wo-login-card.wo-center { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wo-login-brand { text-align: center; margin-bottom: 24px; }
.wo-login-brand h1 { font-size: 24px; margin-top: 12px; }
.wo-login-brand p { margin: 4px 0 0; color: var(--wo-muted); }
.wo-login-logo { max-height: 56px; max-width: 200px; }
.wo-login-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.wo-login-foot { color: var(--wo-muted); font-size: 13px; margin-top: 20px; }

/* App layout */
.wo-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--wo-sidebar); z-index: 40;
  background: var(--wo-surface); border-right: 1px solid var(--wo-border);
  display: flex; flex-direction: column;
}
.wo-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; color: var(--wo-text); font-weight: 800; font-size: 18px; }
.wo-brand-logo { max-height: 36px; max-width: 120px; }
.wo-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
.wo-nav-section { margin-bottom: 8px; }
.wo-nav-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--wo-muted); padding: 12px 10px 6px; }
.wo-nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  color: var(--wo-text); font-size: 14px; font-weight: 500; position: relative;
}
.wo-nav-link .wo-icon { color: var(--wo-muted); }
.wo-nav-link:hover { background: var(--wo-surface-2); }
.wo-nav-link.is-active { background: var(--wo-primary-soft); color: var(--wo-primary); font-weight: 600; }
.wo-nav-link.is-active .wo-icon { color: var(--wo-primary); }
.wo-soon-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--wo-border); }
.wo-userbox { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--wo-border); }
.wo-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--wo-primary-soft); color: var(--wo-primary); font-weight: 700; }
.wo-userbox-text { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13px; }
.wo-userbox-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-userbox-text span { color: var(--wo-muted); }

.wo-main { margin-left: var(--wo-sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.wo-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; min-height: 64px; background: color-mix(in srgb, var(--wo-bg) 85%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--wo-border);
}
.wo-page-title { font-size: 20px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-topbar-actions { display: flex; align-items: center; gap: 6px; }
.wo-content { padding: 28px; flex: 1; width: 100%; max-width: 1280px; }
.wo-only-mobile { display: none; }
.wo-overlay { display: none; }
.wo-bottombar { display: none; }

/* Cards */
.wo-card { background: var(--wo-surface); border: 1px solid var(--wo-border); border-radius: var(--wo-radius); box-shadow: var(--wo-shadow); }
.wo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.wo-stat { display: flex; flex-direction: column; gap: 6px; padding: 18px; color: var(--wo-text); }
a.wo-stat:hover { border-color: var(--wo-primary); }
.wo-stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--wo-primary-soft); color: var(--wo-primary); }
.wo-stat-label { font-size: 13px; color: var(--wo-muted); }
.wo-stat-value { font-size: 24px; }
.wo-stat-small { font-size: 16px; }
.wo-panel { padding: 20px; margin-bottom: 20px; }
.wo-panel h3 { font-size: 16px; margin-bottom: 12px; }
.wo-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.wo-panel-head h3 { margin: 0; }
.wo-hello { margin-bottom: 20px; }
.wo-hello h2 { font-size: 22px; }
.wo-hello p { margin: 4px 0 0; }
.wo-progress { height: 8px; border-radius: 999px; background: var(--wo-surface-2); overflow: hidden; margin-bottom: 16px; }
.wo-progress span { display: block; height: 100%; background: var(--wo-primary); border-radius: 999px; }
.wo-module-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 24px; }
.wo-module-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--wo-border); }
.wo-module-list a { display: flex; align-items: center; gap: 10px; color: var(--wo-text); font-size: 14px; }
.wo-module-list .wo-icon { color: var(--wo-muted); }

/* Empty states */
.wo-empty { max-width: 520px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.wo-empty-icon { width: 80px; height: 80px; border-radius: 24px; display: flex; align-items: center; justify-content: center; background: var(--wo-primary-soft); color: var(--wo-primary); }
.wo-empty h2 { font-size: 22px; }
.wo-empty p { margin: 0; }

/* Settings */
.wo-settings { gap: 0; }
.wo-switch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 24px; }
.wo-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--wo-border); cursor: pointer; }
.wo-switch-name { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.wo-switch-name .wo-icon { color: var(--wo-muted); }
.wo-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.wo-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.wo-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--wo-border); transition: background .15s; pointer-events: none; }
.wo-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.wo-switch input:checked + i { background: var(--wo-primary); }
.wo-switch input:checked + i::after { transform: translateX(18px); }
.wo-switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--wo-primary-soft); }
.wo-logo-preview { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.wo-logo-preview img { max-height: 40px; max-width: 140px; border-radius: 6px; background: var(--wo-surface-2); padding: 4px; }

/* Tables (become cards on phones) */
.wo-table-wrap { overflow-x: auto; }
.wo-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.wo-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--wo-muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--wo-border); }
.wo-table td { padding: 12px; border-bottom: 1px solid var(--wo-border); vertical-align: middle; }
.wo-table tr:last-child td { border-bottom: 0; }
.wo-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.wo-actions form { margin: 0; }

/* Phones and tablets */
@media (max-width: 960px) {
  .wo-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.wo-nav-open .wo-sidebar { transform: translateX(0); }
  .wo-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 30; }
  body.wo-nav-open .wo-overlay { display: block; }
  .wo-main { margin-left: 0; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .wo-only-mobile { display: inline-flex; }
  .wo-topbar { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 56px; }
  .wo-page-title { font-size: 18px; }
  .wo-content { padding: 16px; }
  .wo-install span { display: none; }
  .wo-install { padding: 0 10px; }
  .wo-bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--wo-surface); border-top: 1px solid var(--wo-border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .wo-bottombar a, .wo-bottombar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px;
    color: var(--wo-muted); font: inherit; font-size: 11px; font-weight: 600; background: none; border: 0; cursor: pointer;
  }
  .wo-bottombar span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wo-bottombar .is-active { color: var(--wo-primary); }
  .wo-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .wo-stat { padding: 14px; }
  .wo-stat-value { font-size: 20px; }
  .wo-grid-2 { grid-template-columns: 1fr; }
  .wo-table thead { display: none; }
  .wo-table, .wo-table tbody, .wo-table tr, .wo-table td { display: block; width: 100%; }
  .wo-table tr { border: 1px solid var(--wo-border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
  .wo-table td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; }
  .wo-table td[data-label]::before { content: attr(data-label); color: var(--wo-muted); font-size: 12px; font-weight: 600; }
  .wo-actions { justify-content: flex-start; }
  .wo-form-actions .wo-btn { width: 100%; }
}
@media (max-width: 380px) {
  .wo-cards { grid-template-columns: 1fr; }
}
