:root {
  color-scheme: light;
  --background: #fff8f0;
  --white: #fff;
  --ink: #382117;
  --muted: #765345;
  --brown: #5b2a1b;
  --accent: #a13d16;
  --line: #eed7c7;
  --soft-orange: #fff0e1;
  --orange: #ff9852;
  --danger: #a33431;
  --radius: 23px;
  font: 16px/1.5 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { min-width: 280px; min-height: 100vh; margin: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:not(:disabled), select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
p, h1, h2, h3 { margin: 0; }
:focus-visible { outline: 2px solid #b94a18; outline-offset: 3px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icons { position: absolute; width: 0; height: 0; overflow: hidden; }
.shell { width: min(1280px, calc(100% - 64px)); margin-inline: auto; }
.main { flex: 1; padding-block: 34px 33px; }

.site-header { background: #fffaf4; border-bottom: 1px solid #f1dfd1; }
.header-inner { min-height: 75px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand { width: fit-content; display: inline-flex; gap: 10px; align-items: center; font-size: 1.7rem; font-weight: 750; letter-spacing: -.068em; line-height: 1; }
.brand-accent { color: #a43f16; }
.main-nav, .account-actions { display: flex; align-items: center; gap: 5px; }
.main-nav a { color: var(--muted); font-size: .9rem; font-weight: 650; padding: 9px 16px; border-radius: 9px; white-space: nowrap; }
.main-nav a:hover, .main-nav a[aria-current='page'] { color: var(--brown); background: #ffead7; }
.account-actions { justify-content: flex-end; gap: 8px; }
.account-name { font-size: .875rem; font-weight: 650; max-width: 146px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn { min-height: 42px; padding: 8px 15px; border: 1px solid transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: .9rem; font-weight: 700; line-height: 1.3; text-align: center; background: transparent; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--orange); color: #3c1a0c; }
.btn-primary:hover { background: #ff8738; }
.btn-dark { color: var(--white); background: var(--brown); }
.btn-dark:hover { background: #793619; }
.btn-outline { background: var(--white); border-color: var(--line); }
.btn-outline:hover, .btn-text:hover { background: var(--soft-orange); }
.btn-danger { background: #a33431; color: var(--white); }
.btn-danger:hover { background: #882623; }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { background: #fbedeb; }

.hero { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: 25px; overflow: hidden; padding: clamp(27px, 4.2vw, 51px); margin-bottom: 19px; border-radius: var(--radius); background: linear-gradient(125deg, #351911 12%, #6b2e18 66%, #9f3915); color: #fff8ee; }
.hero::after { content: ''; position: absolute; z-index: -1; inset: 0 0 0 38%; background: repeating-radial-gradient(ellipse at 79% 48%, transparent 0 33px, #ffc99b19 34px 35px, transparent 36px 58px); mask-image: linear-gradient(90deg, transparent, #000 49%); pointer-events: none; }
.hero h1 { font-size: clamp(2.7rem, 5.2vw, 5rem); font-weight: 790; line-height: .99; letter-spacing: -.079em; }
.hero h1 span { color: #ffae75; }
.hero p, .page-heading p { margin-top: 15px; max-width: 485px; color: var(--muted); font-size: 1.05rem; line-height: 1.5; }
.hero p { max-width: 370px; color: #fce2d1; }
.panel { min-width: 0; background: var(--white); border: 1px solid #eedccf; border-radius: var(--radius); box-shadow: 0 6px 22px #5a311406; }
.generator-panel { padding: 24px 27px 22px; }
.panel-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.panel-icon, .preview-link-icon { width: 44px; height: 44px; border-radius: 13px; background: #ffebd9; color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.panel-heading h2, .admin-panel h2, .analytics-panel h2 { font-size: 1.22rem; line-height: 1.24; letter-spacing: -.033em; }
#generator-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 15px 22px; }
#generator-form > .field { margin: 0; }
.message-section, .draft-preview, .generator-actions { grid-column: 1 / -1; }
.field { margin-bottom: 15px; min-width: 0; }
.field label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .9rem; font-weight: 700; }
.optional { color: var(--muted); font-weight: 450; font-size: .84rem; }
input, select, textarea { color: var(--ink); background: #fffcf8; border: 1px solid var(--line); border-radius: 9px; width: 100%; min-height: 44px; padding: 9px 12px; font-size: .96rem; }
input::placeholder, textarea::placeholder { color: #846254; opacity: 1; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: #ca5e2e; box-shadow: 0 0 0 3px #f6b89260; }
input[aria-invalid='true'], .prefix-field.invalid { border-color: #c66461; }
.phone-row { display: grid; grid-template-columns: 111px minmax(0, 1fr); gap: 8px; }
.select-wrap { position: relative; }
.select-wrap select { height: 100%; appearance: none; padding-right: 25px; font-size: .88rem; font-weight: 650; }
.select-wrap .icon { pointer-events: none; position: absolute; top: 50%; right: 8px; transform: translateY(-50%); width: 16px; }
.message-field, .prefix-field { background: #fffcf8; border: 1px solid var(--line); border-radius: 9px; }
.message-field { position: relative; }
.message-field:focus-within, .prefix-field:focus-within { border-color: #ca5e2e; box-shadow: 0 0 0 3px #f6b89260; }
.message-field textarea { display: block; border: 0; background: transparent; box-shadow: none; resize: vertical; padding-bottom: 3px; min-height: 54px; }
.message-tools { display: flex; justify-content: space-between; align-items: center; padding: 0 11px 6px 8px; }
.emoji-trigger { border: 0; background: transparent; border-radius: 6px; padding: 4px; display: inline-flex; align-items: center; gap: 5px; color: #9e3b15; font-size: .85rem; font-weight: 650; }
.emoji-trigger:hover, .emoji-trigger[aria-expanded='true'] { background: #fff0de; }
.emoji-trigger .icon, .nickname-status .icon { width: 16px; height: 16px; }
.counter, .field-hint, .form-note { color: var(--muted); font-size: .82rem; }
.emoji-picker { position: absolute; z-index: 4; top: calc(100% + 5px); left: 0; width: min(100%, 295px); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 8px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 27px #51280825; }
.emoji-picker button { border: 0; background: transparent; font-size: 1.2rem; min-height: 35px; border-radius: 6px; padding: 2px; }
.emoji-picker button:hover { background: #ffecda; }
.prefix-field { display: flex; align-items: stretch; }
.prefix-field > span { display: grid; place-items: center; padding-inline: 11px; border-right: 1px solid var(--line); border-radius: 8px 0 0 8px; background: #fff0e3; color: #76452e; font-size: .86rem; font-weight: 650; white-space: nowrap; }
.prefix-field input { min-width: 0; border: 0; min-height: 42px; padding-inline: 9px; background: transparent; box-shadow: none; }
.nickname-help { display: flex; justify-content: space-between; gap: 4px 10px; flex-wrap: wrap; align-items: baseline; margin-top: 6px; }
.nickname-status { display: inline-flex; align-items: center; gap: 4px; color: #9c3e19; font-size: .82rem; font-weight: 700; }
.nickname-status.error, .field-error { color: var(--danger); }
.field-error { margin-top: 5px; font-size: .875rem; font-weight: 600; }
.generator-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.generate-button { min-width: 170px; min-height: 46px; }
.form-note { margin-top: 8px; text-align: center; }
.generator-actions .form-note { margin: 0; text-align: left; }
.draft-preview { border: 1px solid var(--line); border-radius: 11px; }
.draft-preview summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; padding: 9px 11px; font-size: .9rem; color: var(--accent); font-weight: 700; }
.draft-preview summary::-webkit-details-marker { display: none; }
.draft-preview .summary-chevron { margin-left: auto; width: 17px; }
.draft-preview[open] .summary-chevron { transform: rotate(180deg); }
.draft-content { display: grid; gap: 5px; padding: 11px; border-top: 1px solid var(--line); background: var(--background); border-radius: 0 0 10px 10px; font-size: .9rem; }
.draft-content p { white-space: pre-wrap; overflow-wrap: anywhere; }
.address-preview { min-width: 0; }
.link-card { display: flex; align-items: center; gap: 13px; min-width: 0; background: #fff7ec; color: #522713; border: 1px solid #ffdabd; border-radius: 17px; padding: 17px; box-shadow: 0 12px 35px #25110744; }
.preview-link-icon { width: 42px; height: 42px; border-radius: 12px; background: #ffdfc6; }
.link-card-text { display: grid; gap: 3px; min-width: 0; }
.link-card-text span { font-size: .82rem; color: #74452f; }
.link-card-text strong { font-size: clamp(.93rem, 1.7vw, 1.16rem); letter-spacing: -.035em; overflow-wrap: anywhere; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview-actions .btn { flex: 1; white-space: nowrap; }
.preview-actions .btn-outline { background: transparent; color: #fff7ec; border-color: #ffffff60; }
.preview-actions .btn-outline:hover { background: #ffffff18; }

.site-footer { border-top: 1px solid #f1dfd1; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; min-height: 63px; }
.footer-brand { display: flex; align-items: center; gap: 8px; font-size: .86rem; }
.footer-brand span { color: var(--muted); padding-left: 9px; border-left: 1px solid var(--line); }
.demo-admin { padding-inline: 8px; color: var(--muted); font-size: .84rem; }
.demo-admin .icon { width: 16px; height: 16px; }

.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-block: 11px 25px; }
.page-heading h1, .public-panel h1 { font-size: clamp(2rem, 5vw, 3.9rem); font-weight: 770; line-height: 1.03; letter-spacing: -.075em; }
.page-heading p { margin-top: 8px; }
.page-heading .btn { flex-shrink: 0; }
.links-panel, .admin-panel { padding: 22px; }
.list-row, .user-row { display: flex; gap: 14px; justify-content: space-between; align-items: center; padding-block: 15px; border-bottom: 1px solid #f3e2d4; }
.list-row:last-child, .user-row:last-child { border-bottom: 0; }
.list-row .row-main { flex: 1; }
.list-row .row-actions { flex-shrink: 0; }
.row-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-main > div { min-width: 0; overflow-wrap: anywhere; }
.row-main h3 { font-size: 1rem; }
.row-main p { color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .icon { width: 17px; height: 17px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.icon-button:hover { background: var(--soft-orange); }
.icon-button.btn-danger-text:hover { background: #fbedeb; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 28px 8px; }
.empty-state p, .muted { color: var(--muted); }
.empty-state .btn { margin-top: 5px; }
.role-label { display: inline-flex; align-items: center; gap: 7px; background: #ffead7; border-radius: 10px; color: #91431c; font-size: .9rem; font-weight: 700; padding: 8px 12px; }
.role-label .icon { width: 17px; height: 17px; }
.overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 17px; }
.metric { padding: 15px; display: grid; color: var(--muted); font-weight: 650; font-size: .88rem; }
.metric strong { color: var(--ink); font-size: 1.75rem; letter-spacing: -.055em; line-height: 1.2; }
.metric .metric-date { font-size: clamp(.9rem, 2.3vw, 1.3rem); letter-spacing: -.025em; }
.link-access-count { color: var(--accent); font-size: .84rem; font-weight: 720; }
.analytics-back { display: inline-flex; margin-bottom: 7px; color: var(--accent); font-size: .9rem; font-weight: 700; }
.analytics-back:hover { text-decoration: underline; }
.analytics-address { overflow-wrap: anywhere; }
.analytics-panel { padding: 19px; }
.analytics-panel h2 { margin-bottom: 9px; }
.analytics-breakdown { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-top: 13px; }
.analytics-breakdown dl { margin: 0; }
.analytics-breakdown dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-block: 6px; border-bottom: 1px solid var(--line); font-size: .91rem; }
.analytics-breakdown dl > div:last-child { border-bottom: 0; }
.analytics-breakdown dt { overflow-wrap: anywhere; }
.analytics-breakdown dd { margin: 0; color: var(--accent); font-weight: 750; }
.access-chart { min-height: 160px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.access-chart li { display: grid; grid-template-rows: 1fr auto; gap: 5px; min-width: 0; text-align: center; }
.bar-area { display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 3px; border-bottom: 1px solid var(--line); }
.bar-value { font-size: .83rem; font-weight: 740; }
.bar { width: min(54%, 52px); min-width: 8px; height: var(--bar-height); border-radius: 6px 6px 0 0; background: #ed722b; }
.bar-label { color: var(--muted); font-size: .8rem; }
.admin-panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.search-field { display: flex; align-items: center; gap: 6px; padding-left: 10px; background: #fffcf8; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); max-width: 100%; }
.search-field:focus-within { border-color: #ca5e2e; box-shadow: 0 0 0 3px #f6b89260; }
.search-field input { min-width: 0; width: 260px; max-width: 100%; padding-left: 0; border: 0; background: transparent; box-shadow: none; }
.user-avatar { display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; color: var(--accent); background: #ffebd9; font-weight: 750; }
.user-info { flex: 1; }
.user-info h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.status-badge { display: inline-flex; width: fit-content; border-radius: 6px; padding: 2px 7px; color: #8f3c17; background: #fff0de; font-size: .77rem; font-weight: 700; }
.status-badge.blocked { color: #943430; background: #faeceb; }
.user-count { min-width: 64px; color: var(--muted); font-size: .9rem; }

.dialog { position: fixed; inset: 0; width: min(465px, calc(100% - 24px)); max-height: calc(100% - 32px); padding: 26px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--white); box-shadow: 0 20px 55px #51250e3b; }
.dialog::backdrop { background: #421e1070; }
.close-button { position: absolute; width: 34px; height: 34px; top: 14px; right: 14px; }
.dialog h2 { margin: 8px 30px 5px 0; font-size: 1.6rem; letter-spacing: -.045em; line-height: 1.2; overflow-wrap: anywhere; }
.dialog-intro { margin-bottom: 17px; color: var(--muted); overflow-wrap: anywhere; }
.dialog .full { width: 100%; margin-top: 5px; }
.dialog .form-note { text-align: left; margin-block: 10px; }
.dialog .demo-options { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 12px; }
.demo-options .btn { font-size: .83rem; padding-inline: 7px; }
.dialog-actions { display: flex; gap: 8px; justify-content: end; flex-wrap: wrap; margin-top: 18px; }
.detail-dialog { width: min(600px, calc(100% - 24px)); }
.detail-dialog h3 { margin-top: 15px; font-size: 1rem; }
.detail-dialog .dialog-links { margin: 0; padding: 0; list-style: none; }
.detail-dialog .dialog-links li { padding-block: 10px; border-bottom: 1px solid #f3e2d4; overflow-wrap: anywhere; }
.detail-dialog .dialog-links p { color: var(--muted); white-space: pre-wrap; }
.public-panel { max-width: 585px; margin: 30px auto; padding: 28px; }
.public-panel h1 { margin: 10px 0; font-size: 2rem; }
.public-panel p { margin-bottom: 14px; color: var(--muted); }
.toast { position: fixed; z-index: 10; right: 16px; bottom: 16px; max-width: min(410px, calc(100% - 32px)); padding: 11px 16px; border: 1px solid #dc8b59; border-radius: 9px; background: var(--brown); color: #fff6e9; box-shadow: 0 8px 24px #51250e30; font-size: .9rem; font-weight: 650; }
.auth-panel { max-width: 465px; margin: 24px auto; padding: 27px; }
.auth-panel h1 { margin: 9px 0 4px; font-size: 1.9rem; line-height: 1.18; letter-spacing: -.05em; }
.auth-submit { width: 100%; }
.auth-switch { margin-block: 14px 0; }
.notice { margin: 0 0 16px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--brown); background: var(--soft-orange); font-weight: 650; }
.search-form, .pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pagination { margin-top: 15px; color: var(--muted); }
.link-card:focus-visible { outline-color: #ffcca3; }

@media (max-width: 850px) {
  .shell { width: calc(100% - 38px); }
  .header-inner { gap: 7px; }
  .main-nav a { padding-inline: 9px; }
  .generator-panel { padding: 18px; }
  .list-row { flex-wrap: wrap; }
  .list-row .row-main { flex-basis: 100%; }
}

@media (max-width: 680px) {
  .main { padding-block: 27px 26px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 17px; margin-bottom: 14px; }
  .hero h1 { font-size: clamp(2.55rem, 10vw, 4.3rem); }
  .hero p { margin-top: 11px; font-size: 1rem; }
  #generator-form { grid-template-columns: minmax(0, 1fr); }
  .generator-actions { flex-wrap: wrap; }
  .generate-button { width: 100%; order: -1; }
  .header-inner { grid-template-columns: auto 1fr; min-height: 0; padding-block: 10px 7px; }
  .brand img { width: 34px; height: 34px; }
  .brand { font-size: 1.4rem; gap: 7px; }
  .account-actions { grid-column: 2; grid-row: 1; }
  .account-actions .btn { min-height: 36px; padding: 5px 8px; }
  .main-nav { grid-column: 1 / -1; }
  .main-nav a { padding: 6px 11px; }
  .footer-inner { padding-block: 8px; flex-wrap: wrap; }
  .page-heading { align-items: start; flex-direction: column; }
  .page-heading p { font-size: 1rem; }
  .list-row, .user-row { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .list-row .row-main, .user-row .row-main { flex-basis: 100%; }
  .row-actions { margin-left: 0; }
  .user-count { padding-block: 9px; }
  .analytics-breakdown { grid-template-columns: 1fr; }
  .analytics-panel { padding: 13px; }
  .access-chart { gap: 4px; }
}

@media (max-width: 370px) {
  .shell { width: calc(100% - 24px); }
  .generator-panel, .links-panel, .admin-panel, .dialog { padding: 13px; }
  .account-name { display: none; }
  .account-actions { gap: 2px; }
  .prefix-field > span { padding-inline: 6px; font-size: .77rem; }
  .overview { gap: 6px; }
  .metric { padding: 8px; }
}

