:root {
  color-scheme: light;
  --ink: #202018;
  --muted: #6f6b5e;
  --paper: #fffdf6;
  --sun: #ffd84d;
  --coral: #ff745c;
  --line: #d9d4c3;
  --shadow: #202018;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #bde8db;
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#20201818 1px, transparent 1px);
  background-size: 18px 18px;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.card {
  position: relative;
  width: min(100%, 470px);
  padding: 38px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 24px 18px 28px 16px;
  box-shadow: 8px 9px 0 var(--shadow);
  transform: rotate(-0.25deg);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand span { color: var(--coral); }
.eyebrow { margin: 8px 0 28px; color: var(--muted); font-size: .83rem; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.2rem); line-height: .98; letter-spacing: -.06em; }
.lede { margin: 13px 0 26px; color: var(--muted); }

.auth-form { display: grid; gap: 9px; }
label { margin-top: 9px; font-weight: 800; font-size: .9rem; }
label small { color: var(--muted); font-weight: 600; }

input {
  width: 100%;
  min-height: 49px;
  padding: 11px 13px;
  border: 2px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input:focus { border-color: var(--ink); box-shadow: 3px 3px 0 var(--sun); }
.password-row { position: relative; }
.password-row input { padding-right: 66px; }
.peek { position: absolute; right: 8px; top: 8px; height: 33px; border: 0; border-radius: 8px; background: #efecdf; font-weight: 800; cursor: pointer; }

.primary {
  min-height: 52px;
  margin-top: 18px;
  border: 2px solid var(--ink);
  border-radius: 12px 15px 11px 14px;
  background: var(--sun);
  color: var(--ink);
  box-shadow: 3px 4px 0 var(--ink);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 5px 0 var(--ink); }
.primary:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.switcher { margin: 26px 0 0; text-align: center; color: var(--muted); font-size: .92rem; }
a { color: #275f52; font-weight: 800; }

.alert { padding: 11px 13px; border: 2px solid #c23d2a; border-radius: 10px; background: #ffe4df; color: #7a2115; font-weight: 700; }
.dashboard { width: min(100%, 680px); }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.text-button { border: 0; padding: 5px; background: transparent; color: #275f52; font: inherit; font-weight: 800; text-decoration: underline; cursor: pointer; }
.list-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.task-count { flex: none; padding: 5px 10px; border: 2px solid var(--ink); border-radius: 999px; background: var(--sun); font-size: .8rem; font-weight: 900; }
.add-task { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 30px; }
.add-task .primary { min-width: 110px; margin-top: 0; }
.task-list { display: grid; gap: 10px; margin: 24px 0 0; padding: 0; list-style: none; }
.task-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px; border: 2px solid var(--line); border-radius: 14px; background: #fff; }
.toggle-form { line-height: 0; }
.check-button { width: 36px; height: 36px; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); color: var(--ink); font-size: 1.1rem; font-weight: 900; cursor: pointer; }
.edit-task { display: grid; grid-template-columns: 1fr auto; gap: 7px; min-width: 0; }
.edit-task input { min-width: 0; min-height: 40px; border-color: transparent; background: transparent; }
.edit-task input:focus { border-color: var(--ink); background: #fff; }
.small-button, .delete-button { border: 0; background: transparent; color: #275f52; font: inherit; font-weight: 850; cursor: pointer; }
.delete-button { padding: 5px 8px; color: #9f3123; font-size: 1.5rem; line-height: 1; }
.task-item.is-complete { background: #efeee7; opacity: .72; }
.task-item.is-complete .edit-task input { color: var(--muted); text-decoration: line-through; }
.task-item.is-complete .check-button { background: var(--sun); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.empty-state { margin-top: 34px; padding: 34px 24px; border: 2px dashed var(--line); border-radius: 16px; text-align: center; }
.empty-state span { display: grid; place-items: center; width: 56px; height: 56px; margin: auto; border: 2px solid var(--ink); border-radius: 50%; background: var(--sun); font-size: 1.7rem; font-weight: 900; }
.empty-state h2 { margin: 15px 0 4px; }
.empty-state p { margin: 0; color: var(--muted); }

@media (max-width: 520px) {
  .card { padding: 28px 22px; box-shadow: 5px 6px 0 var(--shadow); }
  .list-heading { align-items: start; }
  .add-task { grid-template-columns: 1fr; }
  .task-item { grid-template-columns: auto 1fr auto; }
  .edit-task { grid-template-columns: 1fr; }
  .small-button { justify-self: start; }
}

/* Compact ticket workspace */
.workspace {
  --workspace-bg: #f2f1ec;
  min-height: 100vh;
  padding: 20px;
  background: var(--workspace-bg);
  color: #262626;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  transition: background-color .2s ease;
}

.workspace::before { content: none; }
.background-stone { --workspace-bg: #f2f1ec; }
.background-blue { --workspace-bg: #e8eef7; }
.background-green { --workspace-bg: #e7f1eb; }
.background-rose { --workspace-bg: #f4e9e7; }
.background-lilac { --workspace-bg: #eee9f5; }
.background-dark { --workspace-bg: #202124; }

.app-window {
  width: min(1180px, 100%);
  min-height: calc(100vh - 40px);
  margin: 0 auto;
  overflow: visible;
  background: rgba(255, 255, 255, .97);
  border: 1px solid rgba(0, 0, 0, .1);
  border-radius: 13px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .12);
}

.app-header {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid #ececec;
}

.app-header .brand { font-size: .96rem; letter-spacing: -.02em; }
.ticket-total { margin-left: 9px; color: #8a8a8a; font-size: .75rem; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.quiet-button { border: 0; background: transparent; color: #777; font: inherit; font-size: .78rem; cursor: pointer; }
.quiet-button:hover { color: #222; }

.settings-menu { position: relative; }
.settings-menu summary { padding: 5px 8px; border-radius: 6px; color: #777; cursor: pointer; list-style: none; font-weight: 700; }
.settings-menu summary::-webkit-details-marker { display: none; }
.settings-menu summary:hover { background: #f1f1f1; color: #222; }
.settings-panel { position: absolute; top: 35px; right: 0; width: 260px; padding: 14px; border: 1px solid #dedede; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .14); }
.settings-title { margin: 0 0 8px; color: #777; font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.settings-title:not(:first-child) { margin-top: 17px; }
.swatches { display: flex; gap: 7px; }
.swatches button { width: 25px; height: 25px; padding: 0; border: 1px solid rgba(0, 0, 0, .15); border-radius: 50%; cursor: pointer; }
.swatch-stone { background: #f2f1ec; }
.swatch-blue { background: #e8eef7; }
.swatch-green { background: #e7f1eb; }
.swatch-rose { background: #f4e9e7; }
.swatch-lilac { background: #eee9f5; }
.swatch-dark { background: #202124; }
.new-group-form { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.new-group-form input { min-height: 34px; padding: 6px 9px; border: 1px solid #ddd; border-radius: 6px; font-size: .8rem; }
.new-group-form button, .group-settings-list button { border: 0; border-radius: 6px; background: #f0f0f0; color: #555; font-weight: 650; cursor: pointer; }
.group-settings-list { display: grid; gap: 3px; max-height: 150px; margin: 8px 0 0; padding: 0; overflow: auto; list-style: none; }
.group-settings-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 5px; color: #555; font-size: .78rem; }
.group-settings-list form { line-height: 0; }
.group-settings-list button { padding: 2px 6px; background: transparent; font-size: 1rem; }

.content { padding: 42px 44px 60px; }
.title-row { display: flex; justify-content: space-between; align-items: end; }
.section-label { margin: 0 0 6px; color: #a0a0a0; font-size: .67rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.content h1 { margin: 0; font-size: 2rem; line-height: 1.1; letter-spacing: -.045em; }
.slim-alert { margin: 15px 44px 0; padding: 8px 11px; border-width: 1px; font-size: .78rem; }

.quick-add {
  display: grid;
  grid-template-columns: minmax(210px, 2fr) minmax(90px, .65fr) minmax(150px, 1fr) minmax(110px, .8fr) auto;
  gap: 7px;
  margin: 28px 0 22px;
  padding: 8px;
  border: 1px solid #dfdfdf;
  border-radius: 9px;
  background: #fafafa;
}

.quick-add input, .quick-add select, .row-edit input, .row-edit select {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #303030;
  font: inherit;
  font-size: .78rem;
}
.quick-add input:focus, .quick-add select:focus, .row-edit input:focus, .row-edit select:focus { border-color: #c8c8c8; box-shadow: none; background: #fff; outline: none; }
.quick-add .title-input { font-weight: 600; }
.add-button { padding: 0 15px; border: 0; border-radius: 6px; background: #262626; color: #fff; font-weight: 650; cursor: pointer; }
.add-button:hover { background: #000; }

.table-head, .ticket-row {
  display: grid;
  grid-template-columns: 42px minmax(210px, 2fr) minmax(140px, 1fr) minmax(110px, .75fr) 68px 52px 88px;
  align-items: center;
  column-gap: 8px;
}
.table-head { padding: 0 10px 7px; border-bottom: 1px solid #dedede; color: #999; font-size: .64rem; font-weight: 650; text-transform: uppercase; letter-spacing: .045em; }
.ticket-list { margin: 0; padding: 0; list-style: none; }
.ticket-row { min-height: 54px; padding: 7px 10px; border-bottom: 1px solid #eeeeee; }
.ticket-row:hover { background: #fafafa; }
.toggle-form { line-height: 0; }
.circle-check { width: 20px; height: 20px; padding: 0; border: 1px solid #bbb; border-radius: 50%; background: #fff; color: #555; font-size: .7rem; cursor: pointer; }
.row-edit { display: contents; }
.row-edit .row-title { font-weight: 560; }
.ticket-cell { position: relative; display: grid; min-width: 0; }
.ticket-cell .link-input { display: none; }
.ticket-cell:focus-within .link-input { display: block; position: absolute; z-index: 2; top: 35px; left: 0; width: min(280px, 70vw); border: 1px solid #ccc; background: #fff; box-shadow: 0 7px 18px rgba(0,0,0,.1); }
.ticket-link { overflow: hidden; color: #35678f; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.ticket-row time, .days-open { color: #888; font-size: .7rem; }
.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: 3px; }
.row-actions form { line-height: 0; }
.save-button, .delete-button { padding: 4px 6px; border: 0; background: transparent; color: #888; font: inherit; font-size: .7rem; cursor: pointer; }
.save-button:hover { color: #222; }
.delete-button { color: #aaa; font-size: 1.05rem; }
.delete-button:hover { color: #b43d35; }
.ticket-row.is-complete { opacity: .48; }
.ticket-row.is-complete .row-title { text-decoration: line-through; }
.ticket-row.is-complete .circle-check { border-color: #333; background: #333; color: #fff; }
.minimal-empty { padding: 70px 20px; color: #777; text-align: center; }
.minimal-empty p { margin: 0 0 5px; color: #333; font-weight: 600; }
.minimal-empty span { font-size: .8rem; }

@media (max-width: 820px) {
  .workspace { padding: 0; }
  .app-window { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .content { padding: 28px 18px 45px; }
  .slim-alert { margin-inline: 18px; }
  .quick-add { grid-template-columns: 1fr 1fr; }
  .quick-add .title-input, .quick-add input[type="url"] { grid-column: 1 / -1; }
  .add-button { min-height: 34px; }
  .table-head { display: none; }
  .ticket-row { grid-template-columns: 28px minmax(0, 1fr) 64px; gap: 5px; padding: 10px 3px; }
  .row-edit { display: grid; grid-column: 2; grid-template-columns: 1fr 1fr; gap: 2px; }
  .row-edit .row-title { grid-column: 1 / -1; }
  .ticket-cell { min-width: 0; }
  .ticket-row time, .days-open { display: none; }
  .row-actions { grid-column: 3; grid-row: 1; }
}
