.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 40px;
  padding: 9px 18px;
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-sm);
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.btn:hover {
  color: var(--c-text);
  background: var(--c-surface-3);
  border-color: var(--c-text-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.56;
  transform: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(90deg, #d9436b 0%, var(--c-accent) 55%, #f07a93 100%);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(239, 87, 119, 0.18);
}

.btn-primary:hover {
  color: #fff;
  background: linear-gradient(90deg, #e24a71 0%, var(--c-accent-hover) 55%, #f4879e 100%);
  border-color: transparent;
}

.btn-secondary {
  color: var(--c-text);
  background: var(--c-surface-2);
  border-color: var(--c-line-strong);
}

.btn-ghost {
  color: var(--c-text-2);
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
  border-color: var(--c-line);
}

.btn-danger {
  color: var(--c-red);
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.34);
}

.btn-danger:hover {
  color: #ff8b8b;
  background: rgba(255, 107, 107, 0.14);
  border-color: rgba(255, 107, 107, 0.55);
}

.btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: var(--fs-12);
}

.btn-lg {
  min-height: 46px;
  padding: 12px 22px;
  font-size: var(--fs-15);
}

.btn-block {
  width: 100%;
}

.btn[aria-busy="true"] .btn-label {
  position: relative;
  padding-left: 20px;
}

.btn[aria-busy="true"] .btn-label::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.linklike {
  display: inline;
  padding: 0;
  color: var(--c-accent);
  font: inherit;
  background: none;
  border: 0;
  text-decoration: none;
  text-underline-offset: 3px;
}

.linklike:hover {
  color: var(--c-accent-hover);
  text-decoration: underline;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--c-text-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.icon-btn:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
  border-color: var(--c-line);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  color: var(--c-text);
  font-size: var(--fs-13);
}

.field-label .label-note {
  color: var(--c-text-3);
  font-size: var(--fs-11);
  font-weight: 400;
}

.field-hint {
  color: var(--c-text-3);
  font-size: var(--fs-12);
  line-height: 1.55;
}

.field-error {
  min-height: 0;
  color: var(--c-red);
  font-size: var(--fs-12);
  line-height: 1.5;
}

.field-error:empty {
  display: none;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-15);
  line-height: 1.4;
  background: #09090b;
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  outline: 0;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--c-text-3);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--c-line-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
  background: #0b0b0e;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-soft);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  color: var(--c-text-3);
  background: var(--c-surface-2);
  cursor: not-allowed;
  opacity: 0.76;
}

.input.is-invalid,
.textarea.is-invalid,
.select.is-invalid {
  border-color: var(--c-red);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.12);
}

.textarea {
  min-height: 104px;
  resize: vertical;
}

.select {
  padding-right: 36px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--c-text-2) 50%),
    linear-gradient(135deg, var(--c-text-2) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 18px,
    calc(100% - 12px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap .input {
  padding-left: 42px;
}

.input-wrap .input-icon {
  position: absolute;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--c-text-3);
  pointer-events: none;
}

.input-wrap .input:focus + .input-icon,
.input-wrap:focus-within .input-icon {
  color: var(--c-accent);
}

.input-wrap.has-action .input {
  padding-right: 46px;
}

.input-action {
  position: absolute;
  right: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 32px;
  padding: 0;
  color: var(--c-text-3);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
}

.input-action:hover {
  color: var(--c-text);
  background: var(--c-surface-2);
}

.input-action svg {
  width: 17px;
  height: 17px;
}

.input-action .icon-eye-off {
  display: none;
}

.input-action[aria-pressed="true"] .icon-eye {
  display: none;
}

.input-action[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-4);
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  margin-top: var(--s-5);
}

.form-msg {
  min-height: 22px;
  margin-bottom: var(--s-3);
  color: var(--c-text-2);
  font-size: var(--fs-13);
  line-height: 1.55;
}

.form-msg[data-state="error"] {
  color: var(--c-red);
}

.form-msg[data-state="success"] {
  color: var(--c-green);
}

.form-msg[data-state="info"] {
  color: var(--c-blue);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  color: var(--c-text-2);
  font-size: var(--fs-12);
  line-height: 1.6;
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--c-accent);
  flex-shrink: 0;
}

.check input.is-invalid {
  outline: 2px solid var(--c-red);
  outline-offset: 2px;
  border-radius: 3px;
}

.check a {
  color: var(--c-accent);
}

.card {
  position: relative;
  padding: var(--s-5);
  background:
    radial-gradient(95% 95% at 16% 112%, rgba(239, 87, 119, 0.12) 0%, rgba(239, 87, 119, 0.035) 38%, rgba(18, 18, 22, 0) 64%),
    var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 42px rgba(239, 87, 119, 0.025);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.card-title {
  color: var(--c-text);
  font-family: var(--font-display);
  font-size: var(--fs-17);
}

.card-title::before {
  content: "/ ";
  color: var(--c-accent);
}

.card-sub {
  margin-top: var(--s-1);
  color: var(--c-text-3);
  font-size: var(--fs-12);
  line-height: 1.55;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.card + .card {
  margin-top: var(--s-5);
}

.tabs {
  display: flex;
  gap: var(--s-1);
  padding: 4px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
}

.tab {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 7px 12px;
  color: var(--c-text-2);
  font-family: var(--font-sans);
  font-size: var(--fs-13);
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.tab:hover {
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.025);
}

.tab[aria-selected="true"] {
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border-color: var(--c-accent-line);
}

.tabs-line {
  gap: var(--s-5);
  padding: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--c-line);
  border-radius: 0;
}

.tabs-line .tab {
  flex: 0 0 auto;
  padding: 10px 2px 12px;
  margin-bottom: -1px;
  color: var(--c-text-2);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}

.tabs-line .tab:hover {
  color: var(--c-text);
  background: transparent;
}

.tabs-line .tab[aria-selected="true"] {
  color: var(--c-accent);
  background: transparent;
  border-bottom-color: var(--c-accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  color: var(--c-text-2);
  font-size: var(--fs-11);
  line-height: 1.55;
  white-space: nowrap;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
}

.badge-accent {
  color: var(--c-accent);
  background: var(--c-accent-soft);
  border-color: var(--c-accent-line);
}

.badge-green {
  color: var(--c-green);
  background: rgba(76, 175, 125, 0.1);
  border-color: rgba(76, 175, 125, 0.32);
}

.badge-red {
  color: var(--c-red);
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.32);
}

.badge-blue {
  color: var(--c-blue);
  background: rgba(77, 171, 247, 0.1);
  border-color: rgba(77, 171, 247, 0.32);
}

.badge-orange {
  color: var(--c-orange);
  background: rgba(245, 159, 0, 0.1);
  border-color: rgba(245, 159, 0, 0.32);
}

.badge-muted {
  color: var(--c-text-3);
  background: rgba(110, 110, 115, 0.08);
  border-color: rgba(110, 110, 115, 0.22);
}

.badge-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
}

.chip-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

.chip-row .badge {
  white-space: normal;
  overflow-wrap: anywhere;
}

.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--c-accent);
  font-family: var(--font-display);
  font-size: var(--fs-17);
  background:
    radial-gradient(circle at 30% 20%, rgba(239, 87, 119, 0.26), transparent 70%),
    var(--c-surface-3);
  border: 1px solid var(--c-accent-line);
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-lg {
  width: 76px;
  height: 76px;
  font-size: var(--fs-28);
  border-width: 2px;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: var(--fs-12);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  min-width: 720px;
  font-size: var(--fs-13);
}

.table th,
.table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-line);
}

.table th {
  color: var(--c-text-3);
  font-size: var(--fs-11);
  font-weight: 400;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.018);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.018);
}

.table .td-actions {
  white-space: nowrap;
}

.table .td-actions .btn + .btn {
  margin-left: var(--s-1);
}

.table .td-main {
  color: var(--c-text);
}

.table .td-sub {
  margin-top: 2px;
  color: var(--c-text-3);
  font-size: var(--fs-11);
}

.table .td-empty {
  padding: var(--s-8) var(--s-4);
  color: var(--c-text-3);
  text-align: center;
}

.cell-user {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 190px;
}

.cell-user .cell-name {
  color: var(--c-text);
  font-size: var(--fs-14);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cell-user .cell-mail {
  color: var(--c-text-3);
  font-size: var(--fs-11);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.cell-lines {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 340px;
}

.cell-line {
  color: var(--c-text-2);
  font-family: var(--font-mono);
  font-size: var(--fs-11);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.item-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--c-line);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--c-line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--c-accent);
  font-family: var(--font-display);
  font-size: var(--fs-12);
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent-line);
  border-radius: var(--r-md);
  flex-shrink: 0;
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  color: var(--c-text);
  font-size: var(--fs-14);
}

.list-meta {
  margin-top: 3px;
  color: var(--c-text-3);
  font-size: var(--fs-11);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.list-side {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

.empty {
  padding: var(--s-7) var(--s-4);
  color: var(--c-text-3);
  font-size: var(--fs-13);
  text-align: center;
}

.empty svg {
  width: 28px;
  height: 28px;
  margin: 0 auto var(--s-3);
  color: var(--c-text-3);
  opacity: 0.7;
}

.loading-line {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-5) 0;
  color: var(--c-text-3);
  font-size: var(--fs-13);
}

.loading-line::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid var(--c-line-strong);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.search-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-box .input {
  padding-left: 40px;
}

.search-box .input-icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--c-text-3);
  transform: translateY(-50%);
  pointer-events: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.pager-info {
  margin-right: var(--s-1);
  color: var(--c-text-3);
  font-size: var(--fs-12);
}

.toast-region {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 12px 14px;
  color: var(--c-text);
  font-size: var(--fs-13);
  line-height: 1.55;
  background: rgba(23, 23, 28, 0.97);
  border: 1px solid var(--c-line-strong);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-md);
  box-shadow: var(--sh-3);
  pointer-events: auto;
  animation: toastIn var(--dur-base) var(--ease-out) both;
}

.toast.is-error {
  border-left-color: var(--c-red);
}

.toast.is-success {
  border-left-color: var(--c-green);
}

.toast.is-info {
  border-left-color: var(--c-blue);
}

.toast.is-out {
  animation: toastOut var(--dur-base) var(--ease-out) both;
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--c-text-3);
  line-height: 1;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.toast-close svg {
  width: 13px;
  height: 13px;
}

.toast-close:hover {
  color: var(--c-text);
  background: var(--c-surface-3);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  padding: 0;
  color: var(--c-text);
  background: var(--c-bg-2);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-4);
  overflow: auto;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.dialog-card {
  padding: var(--s-5);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}

.dialog-title {
  font-family: var(--font-display);
  font-size: var(--fs-20);
  line-height: 1.3;
}

.dialog-sub {
  margin-top: var(--s-1);
  color: var(--c-text-3);
  font-size: var(--fs-12);
  line-height: 1.6;
}

.dialog-close {
  margin: -4px -4px 0 0;
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-5);
}

.secret-box {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: #08080a;
  border: 1px solid var(--c-accent-line);
  border-radius: var(--r-md);
}

.secret-box code {
  flex: 1;
  min-width: 0;
  color: var(--c-accent);
  font-size: var(--fs-13);
  line-height: 1.65;
  overflow-wrap: anywhere;
  user-select: all;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 12px 14px;
  color: var(--c-text-2);
  font-size: var(--fs-12);
  line-height: 1.65;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-orange);
  border-radius: var(--r-sm);
}

.notice svg {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--c-orange);
  flex-shrink: 0;
}

.notice-accent {
  border-left-color: var(--c-accent);
}

.notice-accent svg {
  color: var(--c-accent);
}

.notice-danger {
  border-left-color: var(--c-red);
}

.notice-danger svg {
  color: var(--c-red);
}

.progress {
  position: relative;
  height: 4px;
  background: var(--c-surface-3);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-hover));
  border-radius: inherit;
  transition: width var(--dur-base) var(--ease-out);
}

@media (max-width: 768px) {
  .card {
    padding: var(--s-4);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

  .tabs-line {
    gap: var(--s-4);
    overflow-x: auto;
  }

  .list-item {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .list-side {
    width: 100%;
    padding-left: 54px;
  }

  .search-row {
    flex-wrap: wrap;
  }

  .search-box {
    flex-basis: 100%;
  }

  .toast-region {
    right: var(--s-4);
    bottom: var(--s-4);
  }
}

@media (max-width: 420px) {
  .card {
    padding: var(--s-3);
    border-radius: var(--r-md);
  }

  .btn {
    padding-right: 14px;
    padding-left: 14px;
  }

  .list-side {
    padding-left: 0;
  }

  .dialog-card {
    padding: var(--s-4);
  }

  .toast-region {
    right: var(--s-3);
    bottom: var(--s-3);
    width: calc(100vw - 24px);
  }
}
