/* CraftiPanda Studio — premium light look: warm gray canvas, white rounded cards,
   coral-orange + ink-black pill buttons (palette matched to the brand reference) */
:root {
  --bg: #ebebe9;
  --card: #ffffff;
  --text: #17181a;
  --muted: #8b8f98;
  --border: #e9eae7;
  --ink: #161616;            /* black pills */
  --primary: #e8633c;        /* coral orange */
  --primary-soft: #fbe9e2;
  --primary-text: #ffffff;
  --accent: #e8262a;         /* record-dot red */
  --success: #1f9d55;
  --warn-bg: #fff3d6; --warn-text: #8a6100;
  --ok-bg: #e2f6e9; --ok-text: #176b3c;
  --danger: #d64545; --danger-bg: #fdecec; --danger-text: #a32f2f;
  --status-bg: #efeff4; --status-text: #4a4f66;
  --yt: #ff0033; --fb: #1877f2; --ig: #c13584; --tt: #00bcd4;
  --shadow: 0 1px 2px rgba(23, 24, 26, .04), 0 8px 24px rgba(23, 24, 26, .05);
  --radius: 22px;
}
html[data-theme="dark"] {
  --bg: #101217;
  --card: #191c24;
  --text: #eceef4;
  --muted: #9aa2b8;
  --border: #2a2f3d;
  --ink: #ffffff;
  --primary-soft: #3a2417;
  --warn-bg: #383014; --warn-text: #ffd479;
  --ok-bg: #143420; --ok-text: #6fe09a;
  --danger-bg: #3a1b1b; --danger-text: #ff9d9d;
  --status-bg: #242a4a; --status-text: #aabaff;
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: .4rem 0 1.1rem; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: .98rem; margin: 1rem 0 .4rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
code { background: var(--bg); padding: .1em .4em; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.mt { margin-top: 1.1rem; } .strike { text-decoration: line-through; }
.container { max-width: 1240px; margin: 0 auto; padding: 1.1rem; }

/* ---- Nav ---- */
.nav { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.nav-inner { max-width: 1240px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: 34px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.nav-search input { width: 150px; padding: .4rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.nav-links { display: flex; align-items: center; gap: .85rem; flex: 1; flex-wrap: wrap; }
.nav-links a { color: var(--muted); font-weight: 600; padding: .25rem 0; white-space: nowrap; }
.nav-links a.active, .nav-links a:hover { color: var(--primary); text-decoration: none; }
.nav-spacer { flex: 1; }
.nav-burger { display: none; margin-left: auto; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: .3rem .65rem; font-size: 1.15rem; cursor: pointer; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 9px; padding: .25rem .55rem; cursor: pointer; font-size: 1rem; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { color: var(--primary); }
.link-like { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.inline-form { display: inline; }
.nav-more { position: relative; }
.nav-dropdown { position: absolute; top: 130%; left: 0; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: .6rem 1rem; display: flex; flex-direction: column; gap: .45rem; min-width: 180px; z-index: 60; }
.nav-dropdown[hidden] { display: none; }
.bell { position: relative; font-size: 1.05rem; }
.bell-count { position: absolute; top: -7px; right: -10px; background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 0 .35rem; min-width: 1.1rem; text-align: center; }
.badge-dot { display: inline-block; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; vertical-align: super; }

@media (max-width: 900px) {
  .nav-burger { display: block; }
  .nav-links { display: none; flex-direction: column; align-items: flex-start; width: 100%; gap: .7rem; padding: .6rem 0; }
  .nav-links.show { display: flex; }
  .nav-spacer { display: none; }
  .nav-search { order: 5; width: 100%; }
  .nav-search input { width: 100%; }
  .nav-dropdown { position: static; border: none; box-shadow: none; padding: .2rem 0 .2rem 1rem; }
}

/* ---- Cards / layout ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.card-highlight { border-color: var(--primary); border-width: 2px; }
.card-danger { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.boxed { border: 1px solid var(--border); border-radius: 10px; padding: .8rem; background: var(--bg); }

/* ---- Stats ---- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 1.1rem; }
@media (max-width: 860px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { text-align: center; padding: 1rem .6rem; }
.stat-num { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; }
.stat-label { color: var(--muted); font-size: .82rem; }
.stat-danger .stat-num { color: var(--danger); }
.stat-hero { border-color: var(--primary); border-width: 2px; }
.stat-hero .stat-num { color: var(--primary); }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--bg); border: 1px solid var(--border); }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border: none; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); border: none; }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); border: none; }
.badge-status { background: var(--status-bg); color: var(--status-text); border: none; }
.badge-format { background: var(--primary-soft); color: var(--primary); border: none; }
.badge-prio-low { background: var(--ok-bg); color: var(--ok-text); border: none; }
.badge-prio-normal { background: var(--status-bg); color: var(--status-text); border: none; }
.badge-prio-high { background: var(--warn-bg); color: var(--warn-text); border: none; }
.badge-prio-urgent { background: var(--danger-bg); color: var(--danger-text); border: none; }
.badge-platform-youtube { background: var(--yt); color: #fff; border: none; }
.badge-platform-facebook { background: var(--fb); color: #fff; border: none; }
.badge-platform-instagram { background: var(--ig); color: #fff; border: none; }
.badge-platform-tiktok { background: var(--tt); color: #fff; border: none; }
.badge-pub-none { background: var(--bg); color: var(--muted); }
.badge-pub-planned { background: var(--status-bg); color: var(--status-text); border: none; }
.badge-pub-scheduled { background: var(--warn-bg); color: var(--warn-text); border: none; }
.badge-pub-uploaded { background: var(--ok-bg); color: var(--ok-text); border: none; }
.badge-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.score-pill { background: var(--primary); color: #fff; padding: .15rem .65rem; border-radius: 999px; font-weight: 800; }
.stars { color: #e8a913; letter-spacing: 1px; }

/* ---- Presence ---- */
.dot, .presence-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .3rem; background: var(--border); }
.dot-green, .presence-dot[data-status="online"] { background: var(--success); box-shadow: 0 0 0 3px rgba(31, 157, 85, .25); }
.presence-dot[data-status="idle"] { background: #e8a913; box-shadow: 0 0 0 3px rgba(232, 169, 19, .22); }

/* ---- Forms ---- */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .2rem; }
input, select, textarea {
  width: 100%; padding: .65rem .9rem; margin-top: .25rem;
  border: 1px solid var(--border); border-radius: 14px;
  background: var(--bg); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.stack > * + * { margin-top: .9rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; align-items: end; }
.form-row label { margin-bottom: 0; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-actions, .btn-row { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.check-group { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .9rem; }
.check-group legend { font-weight: 600; font-size: .88rem; padding: 0 .3rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: .25rem 0; }
.check input { width: auto; margin: 0; }
.check-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.note-form { display: flex; gap: .5rem; margin-bottom: 1rem; }
.note-form input { flex: 1; margin-top: 0; }
.filter-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filter-row input, .filter-row select { width: auto; margin-top: 0; flex: 1; min-width: 130px; }
.totp-input { font-size: 1.6rem; letter-spacing: .4em; text-align: center; }
.qr { display: block; margin: .6rem 0; border-radius: 10px; background: #fff; padding: 6px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block; padding: .6rem 1.25rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font: inherit; font-weight: 700; text-decoration: none; transition: transform .06s, filter .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; filter: brightness(.96); box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--card); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-warn { background: var(--warn-bg); border-color: var(--warn-text); color: var(--warn-text); }
.btn-big { font-size: 1.12rem; padding: .85rem 1.7rem; width: 100%; text-align: center; }
.btn-block { width: 100%; }
.btn-small { padding: .3rem .7rem; font-size: .85rem; border-radius: 8px; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: .55rem .65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
table.compact th, table.compact td { padding: .3rem .5rem; }
.row-today { background: var(--status-bg); }
.row-muted { opacity: .55; }
table.matrix td.matrix-cell { min-width: 150px; }
.cell-menu summary { cursor: pointer; color: var(--primary); font-weight: 700; }
.cell-menu .stack, .cell-menu form { margin-top: .5rem; }

/* ---- Lists ---- */
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: .3rem 0; }
.row-line { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding: .5rem 0; }
.row-line:last-child { border-bottom: none; }
.note-item { border-bottom: 1px solid var(--border); padding: .5rem 0; }
.note-item:last-child { border-bottom: none; }
.log-list { max-height: 320px; overflow-y: auto; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.notif-unread { background: var(--primary-soft); border-radius: 8px; padding: .5rem .6rem !important; }

/* ---- Kanban ---- */
.board { display: flex; gap: .9rem; overflow-x: auto; padding-bottom: 1.2rem; align-items: flex-start; }
.board-col { min-width: 235px; width: 235px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; }
.board-col-title { margin: 0 0 .6rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.board-col-title .count { background: var(--bg); border-radius: 999px; padding: 0 .5rem; }
.board-col-cards { min-height: 40px; }
.board-col.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; }
.board-card { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: .65rem; margin-bottom: .6rem; color: var(--text); cursor: grab; }
.board-card:hover { text-decoration: none; border-color: var(--primary); }
.board-card.dragging { opacity: .5; }
.board-card-title { font-weight: 700; margin-bottom: .3rem; line-height: 1.3; }
.board-card-meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .3rem; }
.card-overdue { border-left: 4px solid var(--danger); }

/* ---- Calendar grid ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { font-size: .72rem; text-transform: uppercase; color: var(--muted); text-align: center; padding: .2rem 0; }
.cal-cell { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; min-height: 84px; padding: .25rem; font-size: .8rem; overflow: hidden; }
.cal-empty { background: transparent; border: none; }
.cal-today { outline: 2px solid var(--primary); }
.cal-date { font-weight: 700; color: var(--muted); }
.cal-item { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .68rem; cursor: pointer; }
.cal-done { opacity: .55; text-decoration: line-through; }
@media (max-width: 700px) { .cal-cell { min-height: 56px; } .cal-item { font-size: .58rem; } }

/* ---- Embeds / clips ---- */
.drive-embed { width: 100%; aspect-ratio: 16/9; border: 1px solid var(--border); border-radius: 10px; background: #000; }
.drive-embed.tall { aspect-ratio: 16/10; }
.clip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 1100px) { .clip-grid { grid-template-columns: 1fr; } }
.clip-card { border: 1px solid var(--border); border-radius: 10px; padding: .8rem; background: var(--bg); }
.clip-pinned { border-color: var(--primary); border-width: 2px; }
.clip-head { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.clip-comment { padding: .25rem 0; border-top: 1px dashed var(--border); }

/* ---- Inventory / misc ---- */
.inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; }
@media (max-width: 700px) { .inv-grid { grid-template-columns: repeat(2, 1fr); } }
.inv-cell { text-align: center; padding: .6rem .3rem; border: 1px solid var(--border); border-radius: 10px; }
.inv-num { font-size: 1.7rem; font-weight: 800; }
.template-chip { display: inline-flex; align-items: center; gap: .2rem; }

/* ---- Flash / banner ---- */
.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1.1rem; font-weight: 600; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-error { background: var(--danger-bg); color: var(--danger-text); }
.announcement-banner { background: var(--primary-soft); border: 1px solid var(--primary); color: var(--text); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1.1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---- Auth ---- */
.auth-wrap { display: flex; justify-content: center; padding-top: 6vh; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: block; height: 84px; margin: 0 auto .5rem; background: #fff; border-radius: 18px; padding: 8px; }
.auth-title { text-align: center; margin-bottom: .2rem; }

/* ---- Progress / clock ---- */
.progress { height: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 999px; transition: width .4s; }
.clock-status { font-size: 1.15rem; font-weight: 700; }

/* ---- Team rows ---- */
.emp-row { border-bottom: 1px solid var(--border); padding: .55rem 0; }
.emp-row summary { cursor: pointer; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.emp-edit { padding: .8rem 0 .4rem; }
.emp-inactive summary { opacity: .55; }

/* ---- Chat ---- */
.chat-layout { display: grid; grid-template-columns: 270px 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 860px) { .chat-layout { grid-template-columns: 1fr; } .chat-side { order: 2; } }
.chat-chan { display: flex; justify-content: space-between; align-items: center; padding: .35rem .5rem; border-radius: 8px; color: var(--text); font-weight: 600; }
.chat-chan.active, .chat-chan:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.unread-badge { background: var(--accent); color: #fff; border-radius: 999px; font-size: .7rem; padding: 0 .4rem; font-weight: 800; }
.chat-main { display: flex; flex-direction: column; min-height: 70vh; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chat-search { width: 180px; }
.chat-messages { flex: 1; overflow-y: auto; max-height: 56vh; padding: .5rem 0; display: flex; flex-direction: column; gap: .55rem; }
.chat-msg { max-width: 82%; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: .5rem .75rem; }
.chat-msg.mine { align-self: flex-end; background: var(--primary-soft); border-color: var(--primary); }
.chat-msg-body { white-space: pre-wrap; word-break: break-word; }
.chat-img { max-width: 240px; border-radius: 8px; margin-top: .3rem; }
.chat-embed { max-width: 340px; }
.chat-input { display: flex; gap: .5rem; margin-top: .6rem; align-items: center; }
.chat-input input { flex: 1; margin-top: 0; }
.attach-btn { cursor: pointer; font-size: 1.2rem; }
.typing { min-height: 1.2em; }

/* ---- Docs ---- */
.docs-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.1rem; align-items: start; }
@media (max-width: 860px) { .docs-layout { grid-template-columns: 1fr; } }
.docs-niche { margin-top: .6rem; text-transform: uppercase; font-size: .7rem !important; letter-spacing: .05em; }
.active-link { font-weight: 800; }
.docs-body { font-size: 1rem; }

/* ---- Meetings ---- */
.jitsi-frame { width: 100%; height: 70vh; border: none; border-radius: 10px; background: #000; }

/* ---- Heatmap ---- */
.heatmap { overflow-x: auto; }
.heat-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.heat-name { width: 70px; flex-shrink: 0; font-size: .78rem; font-weight: 700; }
.heat-cell { width: 16px; height: 16px; border-radius: 4px; background: var(--bg); border: 1px solid var(--border); }

/* ---- Dashboard hero (greeting band) ---- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1.4rem; flex-wrap: wrap; padding: 1.6rem 1.6rem; }
.hero-left { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.hero-daycircle {
  width: 84px; height: 84px; border-radius: 50%; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; background: var(--card); box-shadow: var(--shadow);
}
.hero-datetext { line-height: 1.25; color: var(--muted); font-weight: 600; border-right: 1px solid var(--border); padding-right: 1.1rem; }
.hero-datetext strong { color: var(--text); font-size: 1.05rem; }
.hero-right { text-align: right; }
.hero-greet { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; }
.hero-sub { font-size: 1.15rem; color: var(--muted); font-weight: 600; }
@media (max-width: 860px) { .hero-right { text-align: left; } .hero-greet { font-size: 1.5rem; } }

/* ---- Print ---- */
@media print {
  .nav, .no-print, .btn, form, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}
