*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
    background: #f4f6fb;
    color: #1f2937;
    line-height: 1.6;
}

a {
    color: #4f46e5;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1100px, calc(100% - 32px));
    margin: 24px auto 48px;
}

.auth-container {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #111827;
    color: #fff;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.18);
}

.topbar-inner {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}

.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
}

.topbar nav {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.topbar nav a {
    color: #d1d5db;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.page-header h1,
.auth-card h1 {
    margin: 0 0 8px;
    font-size: 1.7rem;
}

.muted {
    color: #6b7280;
}

.card,
.auth-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.auth-card {
    width: min(420px, 100%);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form label {
    display: block;
    margin-bottom: 16px;
    font-weight: 600;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="url"],
.form input[type="number"],
.form select,
.form textarea,
.field-input,
.field-select,
.filter-bar select {
    width: 100%;
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font: inherit;
    background-color: #fff;
    color: #1f2937;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form select,
.field-select,
.filter-bar select {
    appearance: none;
    padding-right: 42px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

.field-input {
    margin-top: 0;
}

.form select:disabled,
.field-select:disabled {
    background-color: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.form input[type="text"]:hover,
.form input[type="password"]:hover,
.form input[type="url"]:hover,
.form input[type="number"]:hover,
.form select:hover,
.form textarea:hover,
.field-input:hover,
.field-select:hover,
.filter-bar select:hover {
    border-color: #9ca3af;
}

.form input[type="text"]:focus,
.form input[type="password"]:focus,
.form input[type="url"]:focus,
.form input[type="number"]:focus,
.form select:focus,
.form textarea:focus,
.field-input:focus,
.field-select:focus,
.filter-bar select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form textarea {
    resize: vertical;
}

.checkbox {
    display: flex !important;
    align-items: center;
    gap: 10px;
    font-weight: 500 !important;
}

.checkbox input {
    width: auto;
    margin: 0;
}

.help,
small.help {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-weight: 400;
    font-size: 0.92rem;
}

.required {
    color: #dc2626;
    font-size: 0.85rem;
    margin-left: 6px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #e5e7eb;
    color: #111827;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
    filter: brightness(0.98);
}

.btn-primary {
    background: #4f46e5;
    color: #fff;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border-color: #d1d5db;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 0.92rem;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.table th {
    font-size: 0.92rem;
    color: #6b7280;
}

.actions {
    vertical-align: middle;
    white-space: nowrap;
}

.actions-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    vertical-align: middle;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;
    font-size: 0.85rem;
}

.badge-success {
    background: #ecfdf5;
    color: #047857;
}

.badge-muted {
    background: #f3f4f6;
    color: #6b7280;
}

.badge-assignee {
    background: #eff6ff;
    color: #1d4ed8;
}

.badge-category {
    background: #f5f3ff;
    color: #6d28d9;
}

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 20px 24px;
}

.filter-bar label {
    margin: 0;
    flex: 1 1 280px;
    max-width: 420px;
    font-weight: 600;
    color: #374151;
}

.filter-bar select {
    min-height: 44px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.form-inline-add {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.form-inline-add label {
    margin: 0;
    min-width: 240px;
}

.settings-page {
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.settings-section-title {
    margin: 0 0 16px;
    font-size: 1.35rem;
    color: #111827;
}

.settings-stack {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.card-subtitle {
    margin: 0 0 16px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #374151;
}

.input-inline {
    width: auto;
    min-width: 200px;
    flex: 1 1 200px;
    max-width: 320px;
}

.assignee-name-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.assignee-table td {
    vertical-align: middle;
}

.assignee-table .actions-inner {
    min-height: 42px;
}

.card h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
}

.empty-state.compact {
    padding: 16px;
}

.info-card code,
.api-preview code {
    display: inline-block;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 6px;
    word-break: break-all;
}

.copy-shortcode {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
    font: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.copy-shortcode code {
    display: inline-block;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 6px;
    word-break: break-all;
    color: #1f2937;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.copy-shortcode:hover code {
    background: #eef2ff;
    color: #4338ca;
}

.copy-shortcode.is-copied code {
    background: #ecfdf5;
    color: #047857;
}

.auth-key-display {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px;
}

.auth-key-copy code {
    font-size: 0.95rem;
    padding: 8px 12px;
}

.auth-key-copy-hint {
    font-size: 0.85rem;
}

.auth-key-actions {
    margin-bottom: 20px;
}

.auth-key-form {
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.auth-key-form .field-input {
    max-width: 480px;
}

.form-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.auth-key-empty {
    margin: 12px 0 16px;
}

.card-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header-inline h2 {
    margin: 0;
    font-size: 1.15rem;
}

.item-list {
    display: grid;
    gap: 12px;
}

.item-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.item-rank {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #eef2ff;
    color: #4338ca;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.item-meta {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.api-preview {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.image-preview img {
    max-width: 180px;
    max-height: 180px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.repeat-section {
    margin: 24px 0;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.repeat-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.repeat-section-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.repeat-list {
    display: grid;
    gap: 12px;
}

.repeat-item {
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafbff;
}

.repeat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.page-header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.review-list {
    display: grid;
    gap: 12px;
}

.review-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.review-row-with-image {
    grid-template-columns: 72px 1fr auto;
}

.review-thumb img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.review-content {
    margin: 8px 0 0;
    color: #374151;
}

.sub-nav-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.form-field {
    margin-bottom: 16px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.dropzone {
    position: relative;
    border: 2px dashed #c7d2fe;
    border-radius: 14px;
    background: #f8faff;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.is-dragover {
    border-color: #4f46e5;
    background: #eef2ff;
}

.dropzone-input {
    display: none;
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    border-radius: 999px;
    background: #e0e7ff;
    color: #4338ca;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.dropzone-empty p {
    margin: 0 0 4px;
}

.dropzone-preview img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 12px;
}

.repeat-section-footer {
    margin-top: 12px;
}

.item-row-simple {
    grid-template-columns: 1fr auto;
}

@media (max-width: 860px) {
    .grid-2,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .item-row {
        grid-template-columns: 48px 1fr;
    }

    .item-actions {
        grid-column: 2;
    }
}
