/* hhubb-crm admin — plain and fast. System font, donor's admin look.
   Brand accents: #c8a882 (Home sand) / #bbed50 (Brave lime) — column highlights only. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --sand: #c8a882; --lime: #bbed50;
  --bg: #f5f6f8; --card: #fff; --text: #1d2430; --muted: #7a8494;
  --border: #e3e6ea; --danger: #d64545;
}
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
button { cursor: pointer; font: inherit; border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 7px 14px; }
button.primary { background: var(--text); color: #fff; border-color: var(--text); }
input, select, textarea { font: inherit; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fff; width: 100%; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 32px; width: 340px; }
.login-card h1 { font-size: 22px; margin-bottom: 14px; }
.login-card h1 span { color: var(--sand); }
.login-card button { width: 100%; margin-top: 12px; background: var(--text); color: #fff; border-color: var(--text); }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.demo-code { margin-top: 10px; font-family: monospace; font-size: 20px; letter-spacing: 6px; text-align: center; background: #f8f9fa; border: 2px dashed var(--sand); border-radius: 8px; padding: 8px; }

/* Shell */
.topbar { display: flex; align-items: center; gap: 24px; background: var(--card); border-bottom: 1px solid var(--border); padding: 10px 20px; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 800; font-size: 16px; }
.brand span { color: var(--sand); }
#nav { display: flex; gap: 4px; flex: 1; }
#nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
#nav a.active { color: var(--text); background: var(--bg); }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--muted); }
main { padding: 20px; max-width: 1280px; margin: 0 auto; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafbfc; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fafbfc; }
td select { width: auto; padding: 4px 6px; font-size: 13px; }

.filters { display: flex; gap: 10px; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-width: 160px; }
.filters input[type=search] { flex: 1; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; background: var(--bg); }
.badge.new { background: #fff3d6; } .badge.won { background: #dcf5c8; } .badge.lost { background: #fde3e3; }
.initials { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--sand); color: #fff; font-size: 11px; font-weight: 700; }

/* Tiles + profit */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.tile .t-label { font-size: 12px; color: var(--muted); }
.tile .t-value { font-size: 22px; font-weight: 800; margin-top: 4px; }
.tile .t-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.profit { background: var(--card); border: 1px solid var(--sand); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.profit h3 { font-size: 14px; margin-bottom: 10px; }
.profit .p-row { display: flex; justify-content: space-between; padding: 4px 0; }
.profit .p-row.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 800; }
.costs { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.costs .c-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.costs .c-row input { width: 140px; }

/* Kanban */
.kanban-head { margin-bottom: 12px; }
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
.kcol { background: var(--card); border: 1px solid var(--border); border-radius: 10px; min-height: 200px; }
.kcol.drag-over { outline: 2px dashed var(--muted); }
.kcol-head { padding: 10px 12px; font-weight: 700; font-size: 13px; border-bottom: 2px solid var(--border); display: flex; justify-content: space-between; }
.kcol[data-col="todo"] .kcol-head, .kcol[data-col="doing"] .kcol-head { border-bottom-color: var(--lime); }
.kcol[data-col="review"] .kcol-head, .kcol[data-col="done"] .kcol-head { border-bottom-color: var(--sand); }
.kcol-count { color: var(--muted); font-weight: 400; }
.kcards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kcard { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard.dragging { opacity: .5; }
.kcard .k-title { font-weight: 600; margin-bottom: 6px; }
.kcard .k-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.due-badge { padding: 1px 7px; border-radius: 20px; background: var(--bg); font-size: 11px; }
.due-badge.overdue { background: var(--danger); color: #fff; }
.k-link { color: var(--muted); text-decoration: none; }
.k-link:hover { text-decoration: underline; }

/* Drawer */
.drawer-overlay, .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw; background: var(--card); z-index: 50; padding: 20px; overflow-y: auto; box-shadow: -4px 0 20px rgba(0,0,0,.1); }
.drawer h2 { font-size: 18px; margin-bottom: 4px; }
.drawer .d-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.drawer .d-block { margin-bottom: 14px; }
.drawer .d-block b { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.drawer textarea { min-height: 90px; }
.drawer .d-actions { display: flex; gap: 10px; margin-top: 16px; }
.d-close { float: right; border: none; background: none; font-size: 20px; color: var(--muted); }

/* Modal */
.modal-overlay { display: flex; align-items: center; justify-content: center; }
.modal { background: var(--card); border-radius: 12px; padding: 24px; width: 440px; max-width: 92vw; }
.modal h3 { margin-bottom: 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* Social */
.social-form { display: flex; gap: 10px; margin-bottom: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.social-form input[type=text] { flex: 1; }
.social-form input[type=url] { flex: 2; }
.social-form select { width: auto; }
.share-links a { margin-right: 8px; font-size: 12px; }

@media (max-width: 900px) {
  .kanban { grid-template-columns: 1fr; }
  .filters { flex-wrap: wrap; }
  .social-form { flex-direction: column; }
}

/* Продукти */
.products-msg { min-height: 20px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
#view-products table input { padding: 5px 8px; }
