@font-face {
  font-family: "TT Days Sans";
  src: url("/assets/fonts/TTDaysSans-Regular.woff2") format("woff2");
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Days Sans";
  src: url("/assets/fonts/TTDaysSans-Bold.woff2") format("woff2");
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "F37 Ginger";
  src: url("/assets/fonts/F37GingerCyrillic-VF.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ui: "TT Days Sans", system-ui, sans-serif;
  --font-display: var(--potok-brand-font-family);
  --ink: #07111f;
  --cream: #f6f4ef;
  --paper: #fff;
  --muted: #6b7280;
  --line: rgba(7, 17, 31, .1);
  --line-strong: rgba(7, 17, 31, .16);
  --blue: #246bfe;
  --emerald: #20aa67;
  --coral: #ef6a68;
  --lime: #c8ff5a;
  --project-accent: #246bfe;
  --shadow-soft: 0 14px 42px rgba(7, 17, 31, .07);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% -4%, rgba(36, 107, 254, .11), transparent 28rem),
    radial-gradient(circle at 91% 1%, rgba(32, 170, 103, .08), transparent 24rem),
    var(--cream);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button,
input { font: inherit; }

button { color: inherit; }

button,
a,
input { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(36, 107, 254, .3);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  color: white;
  background: var(--ink);
  font-size: 10px;
  font-weight: 700;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  height: var(--potok-header-height);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: var(--potok-header-gap);
  padding: 0 var(--potok-gutter-x);
  border-bottom: 1px solid rgba(7, 17, 31, .08);
  background: rgba(246, 244, 239, .9);
  box-shadow: var(--potok-header-shadow);
  backdrop-filter: blur(18px);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--potok-brand-gap);
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: var(--potok-brand-mark-size);
  height: var(--potok-brand-mark-size);
  flex: 0 0 auto;
  border-radius: 3px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: var(--potok-brand-name-size);
  font-weight: 760;
  letter-spacing: -.035em;
}

.brand-divider { color: #a0a6ad; }

.brand strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: var(--potok-brand-scope-size);
  font-weight: 720;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: #5f6975;
  background: rgba(255, 255, 255, .7);
  font-size: 8.5px;
  font-weight: 700;
  text-decoration: none;
}

.account {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.account-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  text-align: right;
}

.account-copy strong,
.account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong { font-size: 8.5px; }
.account-copy small { color: var(--muted); font-size: 7px; }

.account-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid white;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #5b5bf7, #2d79c8);
  box-shadow: 0 5px 14px rgba(7, 17, 31, .14);
  font-size: 8px;
  font-weight: 800;
  overflow: hidden;
}
.account-avatar img { width: 100%; height: 100%; min-width: 100%; min-height: 100%; max-width: 100%; max-height: 100%; aspect-ratio: 1; display: block; border-radius: 50%; object-fit: cover; }

main {
  min-height: calc(100vh - var(--potok-header-height) - var(--potok-footer-height));
  padding: var(--potok-content-gap-top) var(--potok-gutter-x) var(--potok-content-gap-bottom);
}

.state-card {
  width: min(650px, 100%);
  min-height: 138px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 9vh auto 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-soft);
}

.loading-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 3px solid rgba(36, 107, 254, .14);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.state-card > div { min-width: 0; }
.state-card > div > strong { display: block; font-family: var(--font-display); font-size: 18px; }
.state-card > div > span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }

.auth-state { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.auth-state h1 { margin: 0; font-family: var(--font-display); font-size: 23px; letter-spacing: -.035em; }
.auth-state p { max-width: 430px; margin: 6px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.primary-link,
.primary-button,
.secondary-button,
.danger-button,
.icon-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-link,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 8.5px;
  font-weight: 700;
  text-decoration: none;
}

.primary-link,
.primary-button {
  color: white;
  background: var(--ink);
  box-shadow: 0 7px 18px rgba(7, 17, 31, .14);
}

.secondary-button {
  border: 1px solid var(--line);
  color: #5f6975;
  background: white;
}

.danger-button { color: #a43b39; background: #fdebea; }
.text-button { padding: 5px; color: #66717d; background: transparent; font-size: 8px; font-weight: 700; }

button:disabled {
  opacity: .52;
  cursor: not-allowed;
  box-shadow: none;
}

.collaboration-app {
  min-height: calc(100vh - var(--potok-header-height) - var(--potok-footer-height) - 22px);
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  gap: 10px;
}

.catalog-panel,
.project-area {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, .64);
}

.catalog-panel {
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
}

.catalog-panel > header { padding: 3px 5px 12px; }
.catalog-panel h1 { margin: 0; font-family: var(--font-display); font-size: 22px; letter-spacing: -.035em; }
.catalog-panel p { margin: 5px 0 0; color: var(--muted); font-size: 8px; line-height: 1.45; }

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.project-catalog {
  display: grid;
  align-content: start;
  gap: 5px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.catalog-project {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.catalog-project:hover { background: rgba(255, 255, 255, .72); }

.catalog-project[aria-current="true"] {
  border-color: color-mix(in srgb, var(--catalog-accent) 25%, var(--line));
  background: color-mix(in srgb, var(--catalog-accent) 7%, white);
}

.catalog-accent { width: 7px; height: 31px; border-radius: 5px; background: var(--catalog-accent); }
.catalog-copy { min-width: 0; display: grid; gap: 3px; }
.catalog-copy strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.catalog-copy small { overflow: hidden; color: #7c858f; font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }

.ownership-label {
  padding: 3px 5px;
  border-radius: 5px;
  color: #5d6875;
  background: #eff0f0;
  font-size: 6.5px;
  font-weight: 800;
  white-space: nowrap;
}

.ownership-label.is-owned { color: #176945; background: #e5f5eb; }
.catalog-empty { padding: 16px 7px; text-align: center; }

.project-area { position: relative; overflow: hidden; }
.project-loading { padding: 24px; color: var(--muted); font-size: 9px; }
.project-content { min-width: 0; min-height: 100%; }

.project-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(100deg, color-mix(in srgb, var(--project-accent) 7%, white), rgba(255, 255, 255, .75));
}

.project-header > div:first-child { min-width: 0; }
.project-header h2 { overflow: hidden; margin: 4px 0 0; font-family: var(--font-display); font-size: 23px; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.project-header p { margin: 4px 0 0; color: #6d7681; font-size: 8px; }

.access-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 6px;
  color: color-mix(in srgb, var(--project-accent) 78%, var(--ink));
  background: color-mix(in srgb, var(--project-accent) 10%, white);
  font-size: 7px;
  font-weight: 800;
}

.project-actions { display: flex; flex: 0 0 auto; gap: 7px; }

.notice {
  margin: 8px 10px 0;
  padding: 8px 10px;
  border: 1px solid rgba(36, 107, 254, .15);
  border-radius: 9px;
  color: #315d9d;
  background: #edf4ff;
  font-size: 8px;
  line-height: 1.4;
}

.notice.is-error { border-color: rgba(194, 65, 61, .18); color: #943f3c; background: #fff0ef; }

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 7px;
  overflow-x: auto;
  padding: 9px;
  scrollbar-color: rgba(7, 17, 31, .2) transparent;
  scrollbar-width: thin;
}

.board-column {
  min-width: 0;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--status-color) 13%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--status-color) 3%, #f8f8f6);
}

.column-head {
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--status-color) 12%, var(--line));
}

.column-head h3 { display: flex; align-items: center; gap: 5px; margin: 0; font-size: var(--potok-column-title-size); }
.column-head h3::before { width: 6px; height: 6px; content: ""; border-radius: 50%; background: var(--status-color); }
.column-head span { color: #737c87; font-size: 7px; font-weight: 700; }

.task-list { display: grid; align-content: start; gap: 6px; padding: 6px; }

.task-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(7, 17, 31, .08);
  border-radius: 9px;
  background: white;
  box-shadow: 0 4px 12px rgba(7, 17, 31, .045);
}

.task-card.is-urgent { border-left: 3px solid var(--coral); }
.task-title-line { display: flex; align-items: start; justify-content: space-between; gap: 6px; }
.task-title-line h4 { min-width: 0; margin: 0; font-size: var(--potok-card-title-size); line-height: 1.35; overflow-wrap: anywhere; }
.task-title-line button { flex: 0 0 auto; padding: 2px 4px; border: 0; border-radius: 5px; color: #63707d; background: #f1f2f2; font-size: 7px; font-weight: 700; cursor: pointer; }
.task-card > p { margin: 0; color: #747e89; font-size: 7.5px; line-height: 1.4; }

.task-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: #858d96; font-size: var(--potok-card-meta-size); }
.task-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status-select {
  width: 100%;
  height: 27px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #48535f;
  background: #f8f8f7;
  font-size: 7.5px;
  font-weight: 700;
}

.empty-column {
  min-height: 62px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed color-mix(in srgb, var(--status-color) 22%, var(--line));
  border-radius: 8px;
  color: #949ba4;
  font-size: 7.5px;
}

.owner-panel {
  margin: 0 9px 10px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--project-accent) 18%, var(--line));
  border-radius: 13px;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--shadow-soft);
}

.owner-panel-heading {
  min-height: 59px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}

.owner-panel-heading h2 { margin: 0; font-family: var(--font-display); font-size: 18px; letter-spacing: -.03em; }

.icon-button { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: #66717c; background: #f0f1f1; font-size: 19px; }

.access-grid {
  display: grid;
  grid-template-columns: minmax(255px, 1.1fr) minmax(220px, .9fr) minmax(220px, .9fr);
  gap: 9px;
  padding: 9px;
}

.access-grid > section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfbfa;
}

.access-grid h3 { margin: 0; font-size: 10px; }
.access-grid section > p { margin: 5px 0 11px; color: var(--muted); font-size: 7.5px; line-height: 1.45; }

.invite-form { display: grid; gap: 10px; }
.invite-form > label,
.task-dialog form > label { display: grid; gap: 5px; }
.invite-form > label > span,
.task-dialog form > label > span,
.one-time-link > label { color: #68727d; font-size: 7px; font-weight: 800; text-transform: uppercase; }

.invite-form input[type="email"],
.task-dialog input,
.one-time-link input {
  width: 100%;
  height: 35px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: 0;
  background: white;
  font-size: 9px;
}

.invite-form input:focus,
.task-dialog input:focus,
.one-time-link input:focus { border-color: rgba(36, 107, 254, .45); box-shadow: 0 0 0 3px rgba(36, 107, 254, .08); }

.invite-form fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0; padding: 0; border: 0; }
.invite-form legend { margin-bottom: 5px; color: #68727d; font-size: 7px; font-weight: 800; text-transform: uppercase; }
.invite-form fieldset label { position: relative; display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.invite-form fieldset input { width: 13px; height: 13px; margin: 1px 0 0; accent-color: var(--blue); }
.invite-form fieldset span { display: grid; gap: 2px; }
.invite-form fieldset strong { font-size: 7.5px; }
.invite-form fieldset small { color: #818a94; font-size: 6.5px; line-height: 1.35; }

.one-time-link { display: grid; gap: 6px; margin-top: 10px; padding: 10px; border: 1px solid rgba(32, 170, 103, .2); border-radius: 9px; background: #edf8f1; }
.one-time-link > strong { color: #176945; font-size: 8px; }
.one-time-link > div { display: flex; align-items: center; gap: 5px; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-title span { min-width: 19px; padding: 3px 5px; border-radius: 99px; color: #66717d; background: #ebeded; font-size: 7px; font-weight: 800; text-align: center; }

.access-list { display: grid; align-content: start; gap: 5px; max-height: 270px; overflow-y: auto; scrollbar-width: thin; }
.access-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.access-row-copy { min-width: 0; display: grid; gap: 2px; }
.access-row-copy strong,
.access-row-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-row-copy strong { font-size: 7.5px; }
.access-row-copy span { color: #7c858f; font-size: 6.5px; }
.access-row button { padding: 5px 6px; border: 0; border-radius: 6px; color: #9a4643; background: #fdebea; font-size: 6.5px; font-weight: 800; cursor: pointer; }
.access-empty { padding: 15px 5px; color: #8a929b; font-size: 7.5px; text-align: center; }

.empty-selection {
  min-height: 350px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-selection strong { color: var(--ink); font-family: var(--font-display); font-size: 19px; }
.empty-selection span { font-size: 8.5px; }

.footer {
  min-height: var(--potok-footer-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--potok-gutter-x);
  border-top: 1px solid var(--line);
  color: #858d96;
  background: rgba(255, 255, 255, .5);
  font-size: 8px;
}

.footer strong { color: var(--ink); font-family: var(--font-display); font-size: 11px; }

dialog {
  width: min(420px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  color: var(--ink);
  background: white;
  box-shadow: 0 24px 80px rgba(7, 17, 31, .24);
}

dialog::backdrop { background: rgba(7, 17, 31, .32); backdrop-filter: blur(2px); }
dialog form { display: grid; gap: 15px; padding: 17px; }
dialog h2 { margin: 0; font-family: var(--font-display); font-size: 21px; letter-spacing: -.035em; }
dialog p { margin: 0; color: #626d79; font-size: 9px; line-height: 1.5; }
dialog footer { display: flex; justify-content: flex-end; gap: 7px; }
.dialog-error { padding: 7px 8px; border-radius: 7px; color: #963e3b; background: #fdebea; }
.invite-form-error { margin: 0 !important; padding: 9px 10px; border-radius: 8px; color: #963e3b !important; background: #fdebea; font-size: 13px !important; }

@media (max-width: 1050px) {
  .access-grid { grid-template-columns: 1fr 1fr; }
  .invite-section { grid-row: 1 / span 2; }
}

@media (max-width: 760px) {
  :root { --potok-gutter-x: 11px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; }
  .brand-divider,
  .brand strong,
  .account-copy { display: none; }
  .back-link { justify-self: end; }
  .account { display: none !important; }
  .collaboration-app { grid-template-columns: 1fr; }
  .catalog-panel { max-height: 230px; }
  .project-catalog { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
  .board { grid-template-columns: repeat(5, minmax(78vw, 78vw)); scroll-snap-type: x proximity; }
  .board-column { min-height: 250px; scroll-snap-align: start; }
  .access-grid { grid-template-columns: 1fr; }
  .invite-section { grid-row: auto; }
}

@media (max-width: 520px) {
  .project-header { align-items: start; flex-direction: column; }
  .project-actions { width: 100%; }
  .project-actions button { flex: 1; }
  .auth-state { grid-template-columns: 1fr; }
  .auth-state > img { display: none; }
  .invite-form fieldset { grid-template-columns: 1fr; }
  .one-time-link > div { align-items: stretch; flex-direction: column; }
  .one-time-link button { width: 100%; }
  .footer { align-items: start; flex-direction: column; justify-content: center; padding-top: 10px; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
