/* Greentick Work Tracker — clean business styling, no framework. */
:root {
  --green: #1f9d55;
  --green-dark: #167544;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7f6;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px;

  --grey: #6b7280;  --grey-bg: #eef0f2;
  --blue: #2563eb;  --blue-bg: #e7efff;
  --amber: #b45309; --amber-bg: #fdf0d5;
  --purple: #7c3aed;--purple-bg: #f0e9ff;
  --green-tone: #1f9d55; --green-tone-bg: #e3f5ea;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5;
  display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: .6rem 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .35rem; font-weight: 700; }
.brand .tick {
  display: inline-grid; place-items: center;
  width: 1.4rem; height: 1.4rem; border-radius: 6px;
  background: var(--green); color: #fff; font-size: .9rem;
}
.brandname { font-size: 1.1rem; }
.brandsub { color: var(--muted); font-weight: 500; font-size: .85rem; }
.brand-lg { font-size: 1.6rem; justify-content: center; }
.brand-lg .tick { width: 2rem; height: 2rem; font-size: 1.2rem; }

.mainnav { display: flex; gap: .25rem; margin-left: .5rem; }
.mainnav a { padding: .4rem .7rem; border-radius: 8px; color: var(--ink); font-weight: 500; }
.mainnav a:hover { background: var(--grey-bg); text-decoration: none; }
.mainnav a.active { background: var(--green-tone-bg); color: var(--green-dark); }

.userbox { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.uname { color: var(--muted); }
.role { background: var(--green-tone-bg); color: var(--green-dark); font-size: .7rem;
        padding: .05rem .35rem; border-radius: 5px; text-transform: uppercase; }
.userbox .logout { color: var(--muted); }

/* Layout */
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.25rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.back { font-size: .85rem; color: var(--muted); display: inline-block; margin-bottom: .25rem; }
.notes { margin: .25rem 0 0; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: var(--shadow); padding: 1.1rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 460px; }

/* Summary chips */
.summary { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { font-size: .8rem; padding: .25rem .6rem; border-radius: 999px; background: var(--grey-bg); color: var(--ink); }
.chip.total { background: #fff; border: 1px solid var(--line); }

/* Tone colors (status) */
.tone-grey   { background: var(--grey-bg);   color: var(--grey); }
.tone-blue   { background: var(--blue-bg);   color: var(--blue); }
.tone-amber  { background: var(--amber-bg);  color: var(--amber); }
.tone-purple { background: var(--purple-bg); color: var(--purple); }
.tone-green  { background: var(--green-tone-bg); color: var(--green-tone); }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end;
           background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
           padding: .9rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.filters label, .form label { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); gap: .25rem; }
.filters .search { flex: 1; min-width: 180px; }

input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .55rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
textarea { resize: vertical; }

/* Buttons */
.btn { display: inline-block; cursor: pointer; font: inherit; font-weight: 600;
       background: #fff; color: var(--ink); border: 1px solid var(--line);
       border-radius: 8px; padding: .45rem .8rem; }
.btn:hover { background: var(--grey-bg); text-decoration: none; }
.btn.primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { background: transparent; }
.btn.small { padding: .25rem .55rem; font-size: .8rem; }
.btn.danger { color: #b91c1c; border-color: #f3c4c4; }
.btn.danger:hover { background: #fdeaea; }
.btn.full { width: 100%; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; background: var(--card);
             border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em;
           color: var(--muted); background: #fafbfb; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
.grid td { padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tr:last-child td { border-bottom: none; }
.grid tr:hover td { background: #fafdfb; }
.empty { text-align: center; color: var(--muted); padding: 1.25rem; }
.is-archived { opacity: .55; }

.cust-link { font-weight: 600; }
.ytunnus { display: block; font-size: .72rem; color: var(--muted); }
.inline { display: inline; margin: 0; }
.status-select, .assignee-select { min-width: 130px; font-weight: 600; }
.comment-count { color: var(--muted); }
.comment-count.has { color: var(--green-dark); font-weight: 600; }

/* Forms */
.form { display: flex; flex-direction: column; gap: .7rem; }
.form.row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form.row .grow { flex: 1; }
.form input, .form select, .form textarea { width: 100%; }
.editbox { margin-bottom: 1.25rem; }
.editbox summary { cursor: pointer; color: var(--muted); }
.editbox .form { margin-top: .75rem; max-width: 480px; }

/* Comments */
.comment-add { margin-bottom: 1rem; }
.comments { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .9rem; }
.comment { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem; background: #fff; }
.comment-meta { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.comment-body { margin-top: .35rem; white-space: pre-wrap; }
.comment-actions { display: flex; gap: 1rem; align-items: center; margin-top: .5rem; }
.comment-actions details summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.comment-actions .form { margin-top: .5rem; }

.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; font-size: .9rem; }

/* Alerts */
.alert { padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }
.alert.error { background: #fdeaea; color: #b91c1c; }
.alert.ok { background: var(--green-tone-bg); color: var(--green-dark); }

/* Login */
.login-wrap { display: grid; place-items: center; min-height: 70vh; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
              box-shadow: var(--shadow); padding: 2rem; width: 100%; max-width: 360px; }
.login-sub { text-align: center; color: var(--muted); margin: .25rem 0 1.25rem; }

/* ---- v2: client groups, task matrix, N/A ------------------------------- */
.tone-na { background: repeating-linear-gradient(45deg,#f4f5f6,#f4f5f6 6px,#eceef1 6px,#eceef1 12px); color: #9aa0a8; }

/* group colours (chips + dots) — one class per tone */
.g-green  { background: var(--green-tone-bg); color: var(--green-dark); }
.g-amber  { background: var(--amber-bg);      color: var(--amber); }
.g-blue   { background: var(--blue-bg);       color: var(--blue); }
.g-purple { background: var(--purple-bg);     color: var(--purple); }
.g-teal   { background: #d6f1ec;              color: #0f766e; }
.g-red    { background: #fde4e4;              color: #b91c1c; }
.g-grey   { background: var(--grey-bg);       color: var(--grey); }
.gdot { display:inline-block; width:.7rem; height:.7rem; border-radius:50%; margin-right:.45rem; }
.gdot.g-green{background:var(--green);} .gdot.g-amber{background:#d97706;} .gdot.g-blue{background:var(--blue);}
.gdot.g-purple{background:var(--purple);} .gdot.g-teal{background:#0f766e;} .gdot.g-red{background:#b91c1c;} .gdot.g-grey{background:#9ca3af;}

/* group editor */
.grouprow { display:flex; gap:1rem; flex-wrap:wrap; }
.editgroup { margin-top:.7rem; max-width:580px; }
.taskcheck { border:1px solid var(--line); border-radius:8px; padding:.55rem .8rem; display:flex; flex-wrap:wrap; gap:.4rem 1.2rem; }
.taskcheck legend { font-size:.76rem; color:var(--muted); padding:0 .3rem; }
.check { display:flex; align-items:center; gap:.35rem; font-size:.85rem; color:var(--ink); }
.check input { width:auto; }
.delgroup { margin-top:.5rem; }
a.chip { text-decoration:none; }
a.chip:hover { filter: brightness(.97); }
a.chip.sel { outline:2px solid currentColor; outline-offset:1px; }
.chip.small { font-size:.7rem; padding:.12rem .45rem; }

/* group sections */
.groupsec { margin-bottom: 1.5rem; }
.grouphead { display:flex; align-items:center; font-size:1.02rem; margin:.4rem 0 .6rem; }

/* the month × task matrix */
.matrix th.task-col { text-align:center; font-size:.7rem; padding:.5rem .3rem; }
.matrix .cust-col { min-width:160px; }
.matrix .cust-cell { white-space:nowrap; }
.matrix .task-cell { padding:.3rem .35rem; text-align:center; }
.cell-select { min-width:94px; font-size:.78rem; font-weight:600; padding:.3rem .3rem; }
.matrix .asg { display:block; font-size:.66rem; color:var(--muted); margin-top:.12rem; }

/* misc */
.month-pick { align-self:center; }
.comment-controls { display:flex; gap:1rem; align-items:flex-end; flex-wrap:wrap; }
.inline-label { display:flex; flex-direction:column; font-size:.78rem; color:var(--muted); gap:.25rem; }
.reset-form { display:inline-flex; gap:.35rem; align-items:center; }
.reset-form input { max-width:150px; }

@media (max-width: 640px) {
  .topbar { gap: .5rem; }
  .userbox { width: 100%; margin-left: 0; }
  .mainnav { margin-left: 0; }
  .page-head { flex-direction: column; }
}
