/* PlusBoard – single stylesheet for board + admin.
   Colours and type follow it-marketing.solutions / standardPlus:
   accent #e94e1b (hover #d44419), ink #191e22, Tailwind greys, Inter. */

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

:root {
    --accent: #e94e1b;          /* standardPlus orange */
    --accent-hover: #d44419;
    --accent-soft: #fdeee8;     /* orange at ~10 % on white */
    --accent-ring: rgba(233, 78, 27, 0.25);
    --ink: #191e22;             /* brand dark */
    --ink-2: #2a3137;
    --ink-soft: #6b7280;        /* gray-500 */
    --ink-muted: #9ca3af;       /* gray-400 */
    --line: #e5e7eb;            /* gray-200 */
    --line-strong: #d1d5db;     /* gray-300 */
    --bg: #f9fafb;              /* gray-50 */
    --bg-2: #f3f4f6;            /* gray-100 */
    --card: #ffffff;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --radius: 10px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--accent-hover); }

h1, h2, h3 { letter-spacing: -0.01em; }

.container { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
/* Admin pages are wider than the board */
.container-wide { max-width: 1200px; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }

/* Top bar ---------------------------------------------------------------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner {
    max-width: 860px; margin: 0 auto; padding: 12px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-inner.wide { max-width: 1200px; }
.brand { font-weight: 700; color: var(--ink); font-size: 1.05rem; display: flex; align-items: center; gap: 12px; }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-sep { width: 1px; height: 26px; background: var(--line-strong); }
.brand-title { font-weight: 600; color: var(--ink-soft); font-size: 0.98rem; white-space: nowrap; }
.brand-mark {
    display: inline-grid; place-items: center;
    width: 28px; height: 28px; border-radius: 8px;
    background: var(--accent); color: #fff; font-size: 1.15rem; font-weight: 700; line-height: 1;
}
.topbar-user { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.user-name { font-size: 0.9rem; color: var(--ink-soft); font-weight: 500; }
a.user-name:hover { color: var(--ink); text-decoration: none; }

/* Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-block; padding: 9px 16px; border-radius: var(--radius);
    border: 1px solid transparent; font: inherit; font-weight: 600;
    cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); text-decoration: none; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); text-decoration: none; }
.btn:focus-visible, .vote-btn:focus-visible, .seg-btn:focus-visible { outline: 3px solid var(--accent-ring); outline-offset: 1px; }

/* Form controls (shared) ------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], textarea, select {
    font: inherit; color: var(--ink);
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: none; border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-ring);
}

/* Board head, tabs, toolbar ---------------------------------------------- */
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.board-head h1 { margin: 0 0 4px; font-size: 1.6rem; font-weight: 700; }
.board-head p { margin: 0; }

.tabs {
    display: flex; gap: 4px; margin-bottom: 16px;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    /* Line drawn as inset shadow instead of a border, so the 2 px tab
       underline can sit on top of it without a negative margin – a negative
       margin would overflow the box by 1 px and trigger a scrollbar. */
    box-shadow: inset 0 -1px 0 var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 8px 14px; color: var(--ink-soft); font-weight: 600;
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg-btn { border: 0; background: transparent; padding: 8px 14px; font: inherit; cursor: pointer; color: var(--ink-soft); }
.seg-btn.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toolbar select, .toolbar .search {
    padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; background: var(--card);
}
.toolbar .search { flex: 1; min-width: 180px; }

/* Post list -------------------------------------------------------------- */
.post-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.post-row {
    display: flex; gap: 14px; padding: 14px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.post-row:hover { border-color: var(--line-strong); box-shadow: 0 4px 12px rgba(25, 30, 34, 0.06); }
.post-body { min-width: 0; flex: 1; }
.post-title { font-weight: 700; color: var(--ink); font-size: 1.02rem; }
.post-title:hover { color: var(--accent); }
.post-excerpt { margin: 4px 0 8px; color: var(--ink-soft); font-size: 0.92rem; }
.post-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 0.85rem; }
.comment-count { display: inline-flex; align-items: center; gap: 4px; }
.comment-count .icon { display: block; }

/* Vote button ------------------------------------------------------------ */
.vote-btn {
    flex: 0 0 auto; align-self: flex-start;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 52px; padding: 8px 6px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--card); cursor: pointer; font: inherit;
    color: var(--ink-soft); transition: all 0.15s ease;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.vote-btn.is-voted { background: var(--accent); border-color: var(--accent); color: #fff; }
.vote-btn.is-voted:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.vote-caret { font-size: 0.7rem; line-height: 1; }
.vote-count { font-weight: 700; font-size: 1rem; font-variant-numeric: tabular-nums; }

/* Status badges ---------------------------------------------------------- */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-open        { background: var(--bg-2); color: #4b5563; }
.badge-planned     { background: #e0e7ff; color: #3730a3; }
.badge-in_progress { background: #fef3c7; color: #92400e; }
.badge-done        { background: #d1fae5; color: #065f46; }
.badge-declined    { background: var(--danger-soft); color: #991b1b; }
.badge-team        { background: var(--accent-soft); color: var(--accent); }

/* Empty state, gate ------------------------------------------------------ */
.empty, .gate {
    background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius);
    padding: 48px 24px; text-align: center; margin-top: 24px;
}
.gate h1 { margin-top: 0; }

/* Post detail ------------------------------------------------------------ */
.back-link { display: inline-block; margin-bottom: 16px; font-weight: 600; }
.post-detail {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; margin-bottom: 28px;
}
.post-detail-head { display: flex; gap: 16px; margin-bottom: 14px; }
.post-detail-head h1 { margin: 0 0 6px; font-size: 1.35rem; }
.post-description { white-space: normal; }
.post-actions { margin-top: 12px; display: flex; gap: 8px; }

/* Comments --------------------------------------------------------------- */
.comments h2 { font-size: 1.1rem; }
.comment-list { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comment {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px 14px;
}
.comment-admin { border-left: 3px solid var(--accent); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 0.9rem; flex-wrap: wrap; }
.comment-body { font-size: 0.95rem; }
.comment-form { display: flex; flex-direction: column; gap: 10px; }
.comment-form textarea {
    padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; resize: vertical;
}
.comment-form .btn { align-self: flex-end; }
.btn-small { padding: 3px 9px; font-size: 0.8rem; font-weight: 500; margin-left: auto; }

/* Modal ------------------------------------------------------------------ */
.modal {
    position: fixed; inset: 0; background: rgba(25, 30, 34, 0.6);
    display: grid; place-items: center; padding: 16px; z-index: 50;
}
.modal[hidden] { display: none; }
.modal-card {
    background: var(--card); border-radius: 14px; padding: 24px;
    width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-card h2 { margin: 0 0 16px; font-size: 1.2rem; }
.modal-card label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 0.92rem; }
.modal-card select { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; font-weight: 400; background: var(--card); }
.modal-card input[type="text"], .modal-card textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    font: inherit; font-weight: 400; resize: vertical;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.form-error { color: var(--danger); font-size: 0.9rem; margin: 0 0 10px; }

/* Admin ------------------------------------------------------------------ */
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.92rem; vertical-align: top; }
.admin-table th { background: var(--bg); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 600; }
.admin-table select { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; background: var(--card); }

/* Auth pages ------------------------------------------------------------- */
.login-card {
    max-width: 400px; margin: 8vh auto; background: var(--card);
    border: 1px solid var(--line); border-radius: 14px; padding: 28px;
    box-shadow: 0 10px 30px rgba(25, 30, 34, 0.06);
}
.login-card h1 { margin: 0 0 18px; font-size: 1.25rem; }
.login-card label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 0.92rem; }
.login-card input { display: block; width: 100%; margin: 0 0 12px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; }
.login-card input::placeholder { color: var(--ink-muted); opacity: 1; }
.login-card .check { margin: 2px 0 12px; }
.login-card .btn { width: 100%; }
.login-card .brand { display: inline-flex; margin-bottom: 16px; }
.login-card .brand-logo { height: 40px; }
.login-card p { font-size: 0.92rem; }
.login-card .form-error { margin-bottom: 12px; }

/* Checkbox rows (privacy / contact consent / notifications). The card-scoped
   label rules above are more specific, so the rows are re-declared with the
   same specificity here. */
.check, .login-card label.check, .modal-card label.check, .account-box label.check {
    display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 0.82rem; line-height: 1.45; color: var(--ink-2);
}
.check input { width: auto; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--accent); }

.legal-links { margin-top: 20px; font-size: 0.82rem; color: var(--ink-soft); text-align: center; }
.legal-links a { color: var(--ink-soft); }

/* Footer: dark brand block like the corporate site */
.site-footer {
    background: var(--ink); color: var(--ink-muted);
    margin-top: 40px; padding: 22px 20px;
    display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 0.82rem;
}
.site-footer a { color: var(--ink-muted); }
.site-footer a:hover { color: #fff; }
.site-footer .footer-brand { color: #fff; font-weight: 600; margin-right: auto; }

/* Flash messages */
.flash { padding: 12px 14px; border-radius: var(--radius); font-size: 0.92rem; margin: 0 0 18px; border: 1px solid var(--line); background: var(--card); }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error { background: var(--danger-soft); border-color: #fca5a5; color: #991b1b; }
.flash-info { background: var(--accent-soft); border-color: #f8c9b6; color: var(--ink); }

.comment-gate { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 18px; font-size: 0.92rem; }

/* Admin: user list */
.stat-row { display: flex; gap: 20px; flex-wrap: wrap; margin: 16px 0 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; font-size: 0.88rem; color: var(--ink-soft); }
.stat strong { display: block; font-size: 1.4rem; color: var(--ink); }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--ink-soft); }
.note-field { width: 100%; min-width: 180px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: 0.85rem; resize: vertical; }
.nowrap { white-space: nowrap; }
.col-customer { background: var(--accent-soft); }
.saved { outline: 2px solid var(--accent); }

/* Account lifecycle in the user list */
tr.state-inactive, tr.state-removed { opacity: 0.6; }
tr.state-removed .note-field, tr.state-removed select { opacity: 0.8; }
.account-id { font-variant-numeric: tabular-nums; cursor: help; }
.row-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.row-actions .btn { white-space: nowrap; }
.badge[title] { cursor: help; }

/* Own account page */
.account-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 24px; }
.account-box h2 { margin: 0 0 14px; font-size: 1.05rem; }
.account-box form { max-width: 480px; }
.account-box label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 0.92rem; }
.account-box input[type="text"], .account-box input[type="email"], .account-box input[type="password"] {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; font-weight: 400;
}
.account-box .check { font-weight: 400; }
.account-data { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0 0 16px; font-size: 0.92rem; }
.account-data dt { color: var(--ink-soft); }
.account-data dd { margin: 0; }
.account-danger { border-color: #fecaca; }
.account-delete-form { margin-top: 16px; }

/* Responsive ------------------------------------------------------------- */
@media (max-width: 560px) {
    .board-head { flex-direction: column; }
    .post-detail-head { flex-direction: column; }
    .brand-sep, .brand-title { display: none; }
    .brand-logo { height: 28px; }
}
@media (max-width: 900px) {
    .admin-table { display: block; overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
