:root {
    color-scheme: light;
    --bg: #f5f5f7;
    --surface: #ffffff;
    --surface-soft: #f5f5f7;
    --text: #1d1d1f;
    --text-2: #6e6e73;
    --text-3: #86868b;
    --line: rgba(0, 0, 0, 0.08);
    --line-strong: #d2d2d7;
    --fill: rgba(118, 118, 128, 0.12);
    --fill-hover: rgba(118, 118, 128, 0.2);
    --blue: #0071e3;
    --blue-hover: #0077ed;
    --blue-text: #0066cc;
    --blue-tint: rgba(0, 113, 227, 0.1);
    --green: #34c759;
    --green-text: #248a3d;
    --green-tint: rgba(52, 199, 89, 0.14);
    --orange: #ff9f0a;
    --orange-text: #b25000;
    --orange-tint: rgba(255, 159, 10, 0.16);
    --red: #ff3b30;
    --red-text: #d70015;
    --red-tint: rgba(255, 59, 48, 0.12);
    --radius-card: 18px;
    --radius-control: 12px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.47;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 32px 22px 64px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(245, 245, 247, 0.8);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line);
}

.topbar-inner {
    max-width: 980px;
    min-height: 52px;
    margin: 0 auto;
    padding: 8px 22px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 20px;
}

.brand {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}

.topbar-side {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu {
    display: inline-flex;
    padding: 2px;
    background: var(--fill);
    border-radius: 9px;
}

.menu-item {
    padding: 5px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
}

.menu-item:hover { background: rgba(255, 255, 255, 0.5); }

.menu-item.active {
    background: var(--surface);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.demo-banner {
    padding: 9px 22px;
    background: var(--orange-tint);
    color: var(--orange-text);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 24px;
}

.subbar-title,
.page-header h2 {
    font-size: 28px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.022em;
}

.page-header { margin-bottom: 24px; }

.page-header h2 + * { margin-top: 14px; }

.page-lead {
    font-size: 15px;
    color: var(--text-2);
}

button {
    font-family: inherit;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 980px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

button:hover { background: var(--blue-hover); }

button:disabled {
    background: var(--fill);
    color: var(--text-3);
    cursor: not-allowed;
}

.btn-danger { background: var(--red); }
.btn-danger:hover { background: #ff5247; }

.btn-secondary {
    background: var(--fill);
    color: var(--text);
}

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

.btn-plain {
    background: transparent;
    color: var(--blue-text);
    padding: 6px 4px;
}

.btn-plain:hover {
    background: transparent;
    text-decoration: underline;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-control);
    padding: 9px 13px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"],
input[type="password"],
.user-select {
    flex: 1;
}

textarea {
    width: 100%;
    line-height: 1.45;
    resize: vertical;
}

select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236e6e73' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6.25 8 10l4-3.75'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    cursor: pointer;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.16);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-3);
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ok { background: var(--green-tint); color: var(--green-text); }
.badge-skipped, .badge-already_applied { background: var(--orange-tint); color: var(--orange-text); }
.badge-error, .badge-limit { background: var(--red-tint); color: var(--red-text); }

.card-btn {
    flex: 1;
    display: inline-block;
    text-align: center;
    padding: 7px 16px;
    background: var(--fill);
    border: none;
    border-radius: 980px;
    color: var(--text);
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.card-btn:hover { background: var(--fill-hover); }
.card-btn.btn-primary { background: var(--blue); color: #fff; }
.card-btn.btn-primary:hover { background: var(--blue-hover); }

@media (max-width: 600px) {
    .container { padding: 22px 16px 48px; }
    .topbar-inner { padding: 8px 16px; }
    .subbar-title, .page-header h2 { font-size: 24px; }
}

@media (max-width: 480px) {
    .brand { display: none; }
}
