/* ==========================================================================
   Rocking Rolling ToDo - stage lighting
   Black, dark grey, white, orange and red. Fire at the top, guitars where
   they fit.
   ========================================================================== */

:root {
  --black:      #0a0a0b;
  --coal:       #131316;
  --iron:       #1c1c21;
  --steel:      #2a2a31;
  --smoke:      #6f6f7a;
  --chalk:      #e9e9ee;
  --white:      #ffffff;
  --ember:      #ff6a00;
  --flame:      #ff3b1f;
  --blood:      #c81912;
  --gold:       #ffb000;
  --ok:         #37d67a;
  --radius:     14px;
  --shadow:     0 10px 30px rgba(0, 0, 0, .55);
  --stage:      linear-gradient(135deg, var(--flame), var(--ember) 55%, var(--gold));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(255, 59, 31, .22), transparent 62%),
    radial-gradient(700px 380px at 90% 8%, rgba(255, 176, 0, .10), transparent 60%),
    var(--black);
  color: var(--chalk);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { margin: 0 0 .4em; line-height: 1.15; letter-spacing: .5px; }

h1 {
  font-size: 30px;
  font-weight: 900;
  text-transform: uppercase;
}

.shell { max-width: 1080px; margin: 0 auto; padding: 0 20px 80px; }

/* --- the burning bar across the top -------------------------------------- */

.firebar {
  height: 5px;
  background: var(--stage);
  background-size: 200% 100%;
  animation: crawl 7s linear infinite;
}

@keyframes crawl {
  0%   { background-position:   0% 50%; }
  100% { background-position: 200% 50%; }
}

/* --- header -------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--steel);
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand svg { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 0 10px rgba(255, 106, 0, .5)); }

.brand-text {
  font-weight: 900;
  font-size: 19px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--white);
}
.brand-text span {
  background: var(--stage);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; align-items: center; }

.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--chalk);
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
}
.nav a:hover { background: var(--iron); text-decoration: none; }
.nav a.on {
  border-color: var(--ember);
  color: var(--white);
  background: rgba(255, 106, 0, .12);
}

.whoami { font-size: 13px; color: var(--smoke); margin-left: 8px; }

/* --- cards --------------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, var(--iron), var(--coal));
  border: 1px solid var(--steel);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.group-card {
  position: relative;
  display: block;
  overflow: hidden;
  color: inherit;
  transition: transform .12s ease, border-color .12s ease;
}
.group-card:hover {
  transform: translateY(-3px);
  border-color: var(--ember);
  text-decoration: none;
}
.group-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent, var(--ember));
}

.group-head { display: flex; align-items: center; gap: 12px; }
.group-icon { font-size: 30px; line-height: 1; }
.group-name { font-weight: 800; font-size: 18px; color: var(--white); }
.group-code {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--smoke);
  font-weight: 700;
}

/* --- progress ------------------------------------------------------------ */

.bar {
  height: 9px;
  background: var(--steel);
  border-radius: 999px;
  overflow: hidden;
  margin: 14px 0 8px;
}
.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--stage);
  transition: width .4s ease;
}
.bar.done > i { background: linear-gradient(90deg, var(--ok), #17a35a); }

.meta { font-size: 13px; color: var(--smoke); display: flex; gap: 14px; flex-wrap: wrap; }

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--steel);
  background: var(--iron);
  color: var(--chalk);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.btn:hover { border-color: var(--ember); background: #232329; }
.btn:active { transform: translateY(1px); }

.btn.hot {
  background: var(--stage);
  border-color: transparent;
  color: #1a0a00;
  text-shadow: none;
}
.btn.hot:hover { filter: brightness(1.08); }

.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(200, 25, 18, .55); color: #ff8b7f; }
.btn.danger:hover { background: rgba(200, 25, 18, .16); border-color: var(--blood); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --- forms --------------------------------------------------------------- */

label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 1.1px;
        text-transform: uppercase; color: var(--smoke); margin-bottom: 6px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  background: var(--black);
  border: 1px solid var(--steel);
  border-radius: 10px;
  color: var(--chalk);
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, .16);
}
textarea { resize: vertical; min-height: 74px; }

input[type=color] {
  width: 52px; height: 42px; padding: 3px;
  background: var(--black);
  border: 1px solid var(--steel);
  border-radius: 10px;
}

.field { margin-bottom: 16px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }

/* --- items --------------------------------------------------------------- */

.items { list-style: none; margin: 0; padding: 0; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--steel);
}
.item:last-child { border-bottom: 0; }
.item.child { margin-left: 34px; }
.item.child .desc { font-size: 15px; }

.tick {
  flex: none;
  width: 26px; height: 26px;
  margin-top: 1px;
  border-radius: 8px;
  border: 2px solid var(--steel);
  background: var(--black);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 15px;
  font-weight: 900;
  transition: all .12s ease;
  padding: 0;
}
.tick:hover { border-color: var(--ember); }
.tick.on {
  background: var(--stage);
  border-color: transparent;
  color: #1a0a00;
}
.tick.cancelled { border-color: var(--blood); color: var(--blood); background: rgba(200,25,18,.12); }

.item-body { flex: 1 1 auto; min-width: 0; }
.desc { font-size: 16px; color: var(--chalk); word-wrap: break-word; }
.item.is-done .desc { color: var(--smoke); text-decoration: line-through; }
.item.is-cancelled .desc { color: var(--smoke); text-decoration: line-through; opacity: .7; }

.sub { font-size: 12.5px; color: var(--smoke); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }

.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--steel);
  color: var(--smoke);
}
.tag.task     { border-color: rgba(255,106,0,.5);  color: var(--ember); }
.tag.goal     { border-color: rgba(255,176,0,.5);  color: var(--gold); }
.tag.reminder { border-color: rgba(233,233,238,.3); color: var(--chalk); }
.tag.draft    { border-color: var(--smoke); }

.item-tools { display: flex; gap: 6px; flex: none; opacity: 0; transition: opacity .12s ease; }
.item:hover .item-tools, .item-tools.show { opacity: 1; }

/* A touch screen never fires hover, so the tools would be permanently
   invisible (but still holding their space) on a phone or tablet. Show them. */
@media (hover: none) {
  .item-tools { opacity: 1; }
}

/* --- comments ------------------------------------------------------------ */

.comments { margin: 10px 0 4px; padding: 12px 14px; background: var(--black);
            border: 1px solid var(--steel); border-radius: 10px; }
.comment { padding: 8px 0; border-bottom: 1px dashed var(--steel); font-size: 14.5px; }
.comment:last-of-type { border-bottom: 0; }
.comment b { color: var(--gold); font-weight: 700; }
.comment time { color: var(--smoke); font-size: 12px; margin-left: 8px; }

/* --- stats --------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: 16px; }

.stat { text-align: left; }
.stat .n {
  font-size: 36px;
  font-weight: 900;
  line-height: 1;
  background: var(--stage);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .l { font-size: 11.5px; letter-spacing: 1.4px; text-transform: uppercase;
           color: var(--smoke); font-weight: 700; margin-top: 6px; }

.spark { display: flex; align-items: flex-end; gap: 5px; height: 130px; margin-top: 10px; }
.spark > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
               align-items: center; gap: 6px; height: 100%; }
.spark i {
  display: block;
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: var(--stage);
}
.spark i.zero { background: var(--steel); }
.spark small { font-size: 9.5px; color: var(--smoke); white-space: nowrap; }

/* --- misc ---------------------------------------------------------------- */

.panel-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}

.section { margin-bottom: 26px; }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--smoke);
  border: 1px dashed var(--steel);
  border-radius: var(--radius);
}
.empty .big { font-size: 42px; margin-bottom: 10px; }

.msg {
  padding: 12px 15px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14.5px;
  font-weight: 600;
  display: none;
}
.msg.show { display: block; }
.msg.bad  { background: rgba(200, 25, 18, .16); border: 1px solid var(--blood); color: #ffb3aa; }
.msg.good { background: rgba(55, 214, 122, .12); border: 1px solid rgba(55, 214, 122, .5); color: #9df0c0; }

.hide { display: none !important; }

.linkbox {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--black); border: 1px solid var(--ember);
  border-radius: 10px; padding: 11px 13px; margin-top: 12px;
}
.linkbox input { border: 0; background: transparent; padding: 0; font-size: 14px; flex: 1 1 240px; }
.linkbox input:focus { box-shadow: none; }

table.links { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 14px; }
table.links th {
  text-align: left; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--smoke); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--steel);
}
table.links td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--steel); vertical-align: middle; }
table.links tr.dead td { opacity: .45; }

/* --- login --------------------------------------------------------------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; }
.login-card { width: 100%; max-width: 400px; }
.login-card .card { padding: 30px; }
.login-hero { text-align: center; margin-bottom: 24px; }
.login-hero svg { width: 82px; height: 82px; filter: drop-shadow(0 0 22px rgba(255, 59, 31, .55)); }
.login-hero h1 { margin-top: 12px; font-size: 26px; }
.login-hero p { color: var(--smoke); font-size: 14px; margin: 4px 0 0; }
.hint { margin-top: 18px; font-size: 12.5px; color: var(--smoke); text-align: center; line-height: 1.7; }
.hint code { color: var(--gold); background: var(--black); padding: 1px 6px; border-radius: 5px; }

/* --- guest banner -------------------------------------------------------- */

.guest-note {
  background: rgba(255, 176, 0, .10);
  border: 1px solid rgba(255, 176, 0, .45);
  color: var(--gold);
  border-radius: 10px;
  padding: 12px 15px;
  font-size: 14px;
  margin-bottom: 20px;
}

/* --- small screens --------------------------------------------------------
   design.txt says nothing about phones, so the calls made here are:

   * .item-tools drops onto its own line under the description. At opacity 0
     it was still holding ~180px of the item row, which is what squeezed the
     description down to one word per line on a 360px screen.
   * .row form fields stack instead of fighting over a 180px flex basis. The
     inline flex-basis values in the HTML still hold, so the narrow ones
     (type, days, icon, colour) pair up on the line below.
   * Ticks get bigger, because 26px is under the 44px touch target and this
     is the one control a magic-link visitor actually uses.
   -------------------------------------------------------------------------- */

@media (max-width: 620px) {
  h1 { font-size: 23px; }
  .shell { padding: 0 14px 60px; }
  .nav a { padding: 7px 11px; font-size: 13px; }
  .card { padding: 16px 14px; }

  .row > .field { flex: 1 1 100%; }

  /* the list */
  .item { gap: 11px; padding: 14px 2px; flex-wrap: wrap; }
  /* basis 0, not auto - on `auto` the text measures wider than the space left
     beside the tick, and wraps the whole body onto its own line. */
  .item-body { flex: 1 1 0; }
  .desc { font-size: 15.5px; line-height: 1.45; }
  .item.child .desc { font-size: 15px; }
  .sub { gap: 10px; row-gap: 6px; margin-top: 6px; }

  .tick { width: 32px; height: 32px; font-size: 17px; }

  /* padding, not margin: it sits inside the 100% basis, so the row cannot
     overflow. 32px tick + 11px gap lines the buttons up with the text. */
  .item-tools {
    opacity: 1;
    flex: 1 1 100%;
    padding-left: 43px;
    margin-top: 4px;
    gap: 8px;
  }
  .item-tools .btn.small { padding: 8px 12px; font-size: 13px; }

  /* sub-tasks indent less, and keep the smaller tick they read as */
  .item.child { margin-left: 14px; }
  .item.child .tick { width: 28px; height: 28px; font-size: 15px; }
  .item.child .item-tools { padding-left: 39px; }

  .comments { padding: 10px 12px; }
  .comment { font-size: 14px; }
}
