:root {
  color-scheme: light;
  --ink: #182a3b;
  --muted: #536577;
  --line: #dbe4e9;
  --canvas: #eef3f5;
  --nav: #142836;
  --primary: #166c5d;
  --primary-dark: #10584c;
  --green: #156649;
  --green-bg: #e3f4eb;
  --red: #a62b3a;
  --red-bg: #fcecee;
  --amber: #86600a;
  --amber-bg: #fff3d7;
  font-family: 'Segoe UI',system-ui,sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none!important;
}

body {
  margin: 0;
  min-width: 280px;
  line-height: 1.5;
}

button,input,select,textarea {
  font: inherit;
}

button,select {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .55;
}

:focus-visible {
  outline: 3px solid #248977;
  outline-offset: 3px;
}

h1,h2,p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem,4vw,2.55rem);
  line-height: 1.14;
  letter-spacing: -.04em;
}

h2 {
  font-size: 1.15rem;
  letter-spacing: -.02em;
}

.muted {
  color: var(--muted);
  font-size: .88rem;
}

.skip {
  position: fixed;
  left: 1rem;
  top: -6rem;
  background: white;
  padding: .7rem;
  z-index: 3;
}

.skip:focus {
  top: 1rem;
}

.topbar {
  background: var(--nav);
  color: #fff;
}

.top-inner {
  min-height: 70px;
  padding: 0 1.65rem;
  max-width: 1248px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand,.profile {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.brand-icon,.emblem {
  display: grid;
  place-items: center;
  background: #c9eddc;
  color: #183b35;
  border-radius: 10px;
  font-weight: 800;
  letter-spacing: -.06em;
}

.brand-icon {
  height: 38px;
  width: 42px;
  font-size: .82rem;
}

.brand strong,.brand div span {
  display: block;
}

.brand strong {
  line-height: 1.2;
}

.brand div span {
  color: #b1c4ce;
  font-size: .75rem;
}

.profile {
  font-size: .85rem;
}

.avatar {
  background: #2d4955;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  font-weight: 700;
}

.plain {
  background: transparent;
  border: 1px solid #58717b;
  color: white;
  border-radius: 7px;
  padding: .35rem .6rem;
}

.plain:hover {
  background: #2d4955;
}

.boot {
  padding: 4rem 1rem;
  text-align: center;
  color: var(--muted);
}

.auth {
  max-width: 860px;
  margin: clamp(2rem,8vw,6.2rem) auto 3rem;
  width: calc(100% - 2.5rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: white;
  display: grid;
  grid-template-columns: .94fr 1fr;
  box-shadow: 0 20px 50px #19384814;
}

.auth-aside {
  background: linear-gradient(155deg,#123c39,#163445 72%);
  color: white;
  padding: 2.3rem 2.4rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.2rem;
  min-height: 395px;
}

.auth-aside h2 {
  font-size: clamp(2.25rem,5vw,3.4rem);
  letter-spacing: -.06em;
  margin: .2rem 0 .65rem;
  line-height: 1;
}

.auth-aside p {
  color: #d2e9e4;
  max-width: 26ch;
}

.emblem {
  width: 57px;
  height: 49px;
}

.eyebrow {
  color: #aee8d2;
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.auth-content {
  padding: 2.5rem;
}

.auth-content h1 {
  font-size: 1.9rem;
}

.auth-content>p {
  color: var(--muted);
  margin: .5rem 0 1.5rem;
}

.stack {
  display: grid;
  gap: 1rem;
}

.stack label {
  display: grid;
  gap: .35rem;
  font-weight: 600;
  font-size: .9rem;
}

input:not([type=radio]),select,textarea {
  width: 100%;
  border: 1px solid #b8c8d1;
  background: white;
  border-radius: 8px;
  padding: .68rem .72rem;
  color: var(--ink);
}

textarea {
  resize: vertical;
  font-weight: 400;
  line-height: 1.5;
}

.text-button {
  margin-top: 1rem;
  padding: .2rem 0;
  background: none;
  color: var(--primary-dark);
  border: 0;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .65rem .95rem;
  font-weight: 650;
  white-space: nowrap;
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-dark);
}

.secondary {
  background: #fff;
  border-color: #bfcdd4;
  color: var(--ink);
}

.secondary:hover {
  background: var(--canvas);
}

.button span {
  font-size: 1.2rem;
  line-height: 1;
}

.feedback {
  padding: .65rem .8rem;
  border-radius: 8px;
  background: #e8f5ef;
  color: var(--green);
  font-size: .9rem;
}

.feedback.error {
  background: var(--red-bg);
  color: var(--red);
}

.workspace {
  max-width: 1248px;
  margin: auto;
  padding: 2.65rem 1.65rem 4rem;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}

.page-heading p {
  margin-top: .45rem;
  color: var(--muted);
}

.view-switch {
  display: flex;
  gap: .9rem;
  border-bottom: 1px solid #c9d6dc;
  margin-bottom: 1.35rem;
}

.view-switch button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: .65rem .25rem .6rem;
  color: var(--muted);
  font-weight: 600;
}

.view-switch button[aria-pressed=true] {
  color: var(--primary-dark);
  border-color: var(--primary);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 1rem;
  margin-bottom: 1.35rem;
}

.stat {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
}

.stat div span,.stat strong {
  display: block;
}

.stat div span {
  font-size: .82rem;
  color: var(--muted);
}

.stat strong {
  font-size: 1.55rem;
  line-height: 1.22;
  color: var(--ink);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 700;
  flex: none;
}

.open {
  color: var(--amber);
  background: var(--amber-bg);
}

.approved {
  color: var(--green);
  background: var(--green-bg);
}

.rejected {
  color: var(--red);
  background: var(--red-bg);
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: .7rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.filter {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: var(--muted);
  font-size: .85rem;
}

.filter select {
  width: auto;
  padding: .37rem 1.5rem .37rem .55rem;
}

.panel .feedback {
  margin: 1rem 1.15rem 0;
}

.empty {
  padding: 3.3rem 1rem;
  text-align: center;
}

.empty-sign {
  display: grid;
  place-items: center;
  margin: 0 auto .8rem;
  background: #e9f4ef;
  color: var(--primary);
  width: 42px;
  height: 42px;
  border-radius: 11px;
  font-size: 1.4rem;
  font-weight: 700;
}

.empty h3 {
  margin: 0 0 .25rem;
  font-size: 1rem;
}

.empty p {
  font-size: .9rem;
  color: var(--muted);
}

.task {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: .6rem 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.task:last-child {
  border-bottom: 0;
}

.task-info {
  min-width: 0;
}

.description {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-description {
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-info .muted {
  margin-top: .2rem;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: .23rem .6rem;
  font-weight: 650;
  font-size: .79rem;
}

.action {
  border: 1px solid transparent;
  border-radius: 7px;
  min-width: 37px;
  min-height: 37px;
  padding: .3rem .58rem;
  font-weight: 700;
}

.action.approved,.action.rejected {
  font-size: 1.15rem;
}

.action.approved:hover,
.action.approved[aria-pressed=true] {
  border-color: var(--green);
}

.action.rejected:hover,
.action.rejected[aria-pressed=true] {
  border-color: var(--red);
}

.action.detail {
  background: #edf2f5;
  color: var(--ink);
  font-size: .84rem;
}

.action.detail:hover {
  border-color: #8da5b0;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .7rem;
  padding: .9rem;
  border-top: 1px solid var(--line);
  font-size: .85rem;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  padding: 0;
  width: min(94%,570px);
  max-height: 90vh;
  box-shadow: 0 22px 68px #1228363b;
}

dialog::backdrop {
  background: #142836a8;
}

.dialog-inner {
  padding: 1.25rem;
  gap: .85rem;
}

.dialog-inner header,.dialog-inner footer {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.dialog-inner header {
  justify-content: space-between;
}

.dialog-inner footer {
  justify-content: flex-end;
  margin-top: .25rem;
}

.icon-button {
  background: #edf3f5;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  min-width: 34px;
  min-height: 34px;
  font-size: 1.2rem;
}

.full {
  background: var(--canvas);
  padding: .8rem;
  border-radius: 8px;
  max-height: 32vh;
  overflow: auto;
}

.wide-dialog {
  width: min(96%, 900px);
}

.editor-field {
  display: grid;
  gap: .35rem;
  font-size: .9rem;
  min-width: 0;
}

.editor-frame {
  border: 1px solid #b8c8d1;
  border-radius: 8px;
  overflow: hidden;
}

.format-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--line);
  background: #f1f5f7;
}

.format-controls button {
  width: 2.25rem;
  height: 2.1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: .95rem;
}

.format-controls button:hover {
  border-color: #b8c8d1;
  background: white;
}

.format-controls .grid-control {
  width: auto;
  padding: 0 .6rem;
  font-size: .83rem;
  font-weight: 600;
}

.table-size {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .5rem;
  padding: .5rem;
  border-bottom: 1px solid var(--line);
  background: #f1f5f7;
}

.table-size label {
  min-width: 5rem;
}

.table-size select {
  padding: .32rem .48rem;
}

.table-size .button {
  padding: .34rem .58rem;
}

.rich-editor {
  min-height: 10rem;
  max-height: 44vh;
  padding: .7rem;
  background: white;
  caret-color: var(--ink);
}

.rich-editor:focus-visible {
  outline-offset: -3px;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

.rich-copy {
  overflow: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  min-width: 0;
}

.rich-copy.full {
  max-height: 50vh;
  background: white;
  border: 1px solid var(--line);
}

.rich-copy table {
  width: max-content;
  border-collapse: collapse;
  margin: .25rem 0;
  text-align: left;
}

.rich-copy td,
.rich-copy th {
  padding: .32rem .55rem;
  border: 1px solid #c3d2d9;
  vertical-align: top;
}

.rich-editor .sheet-grid td {
  min-width: 7rem;
}

.sheet-grid [data-grid-ui],
.line-grid .row-number {
  white-space: nowrap;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
}

.sheet-grid th[scope=row][data-grid-ui],
.sheet-grid > thead[data-grid-ui] th:first-child,
.line-grid .row-number {
  width: 1%;
  min-width: calc(4ch + .9rem + 2px);
  padding-inline: .45rem;
}

.sheet-grid [data-grid-ui] {
  background: #e8eff2;
  color: #435a69;
  text-align: center;
  font-weight: 600;
  font-size: .8rem;
  user-select: none;
}

.sheet-grid > thead[data-grid-ui] th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.sheet-grid th[scope=row][data-grid-ui],
.sheet-grid > thead[data-grid-ui] th:first-child {
  position: sticky;
  left: 0;
}

.sheet-grid th[scope=row][data-grid-ui] {
  z-index: 1;
}

.sheet-grid > thead[data-grid-ui] th:first-child {
  z-index: 3;
}

.rich-editor [data-grid-active] {
  outline: 2px solid #217461;
  outline-offset: -2px;
}

.rich-copy .line-grid {
  width: 100%;
}

.line-grid .row-number {
  background: #f1f5f7;
  color: var(--muted);
  text-align: right;
  font-weight: 500;
}

.rich-copy p {
  margin: .25rem 0;
}

.note-title {
  margin: 0 0 .25rem;
  font-size: .9rem;
}

@media(max-width:640px) {
  .top-inner {
    padding: 0 .85rem;
  }
  .profile {
    gap: .38rem;
  }
  .profile .avatar {
    display: none;
  }
  .workspace {
    padding: 1.5rem .85rem 3rem;
  }
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .stats {
    gap: .45rem;
  }
  .stat {
    padding: .55rem .45rem;
    gap: .35rem;
    align-items: flex-start;
  }
  .stat-icon {
    width: 23px;
    height: 23px;
    font-size: .85rem;
  }
  .stat div span {
    font-size: .68rem;
  }
  .stat strong {
    font-size: 1.2rem;
  }
  .task {
    grid-template-columns: 1fr;
    gap: .55rem;
    padding: .85rem;
  }
  .panel-heading {
    padding: .8rem .85rem;
  }
  .filter {
    gap: .25rem;
  }
  .filter select {
    padding-right: .35rem;
  }
  .auth {
    grid-template-columns: 1fr;
    width: calc(100% - 1.7rem);
  }
  .auth-aside {
    min-height: 0;
    padding: 1.3rem;
    gap: .8rem;
  }
  .auth-aside .emblem {
    display: none;
  }
  .auth-aside h2 {
    font-size: 2rem;
  }
  .auth-aside p {
    max-width: none;
    font-size: .88rem;
  }
  .auth-content {
    padding: 1.3rem;
  }
}
