* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f6f7fb;
    color: #1a1a1a;
    line-height: 1.5;
}
a { color: #2454ff; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin-top: 0; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
code { background: #e8ecf4; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.app-header {
    background: linear-gradient(135deg, #0f1d3a 0%, #1a3a6e 100%);
    color: #fff;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.app-header h1 { font-size: 1.5rem; margin-bottom: 4px; }
.app-header p { margin: 0; color: #c9d4f2; font-size: 14px; }
.header-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.badge {
    background: rgba(255,255,255,0.15);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
}
.badge.user-badge {
    background: rgba(36, 84, 255, 0.3);
}
.badge.logout-badge {
    background: rgba(220, 38, 38, 0.3);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}
.badge.logout-badge:hover {
    background: rgba(220, 38, 38, 0.5);
    text-decoration: none;
}

.tabs {
    background: #fff;
    border-bottom: 2px solid #e3e6ef;
    display: flex;
    gap: 4px;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.tabs a {
    padding: 14px 18px;
    border-radius: 8px 8px 0 0;
    color: #4a5568;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.tabs a:hover {
    background: #f0f4ff;
    text-decoration: none;
}
.tabs a.active {
    background: #f0f4ff;
    color: #2454ff;
    border-bottom-color: #2454ff;
}

.panel {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(15, 29, 58, 0.06);
    border: 1px solid #e8ecf4;
}
.panel h2 { color: #1a2744; margin-bottom: 8px; }
.panel h3 { color: #2d3748; margin-bottom: 12px; font-size: 1.1rem; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.row.wrap { flex-wrap: wrap; }
.actions { justify-content: flex-start; margin-top: 16px; gap: 12px; }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
    font-size: 13px;
}
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2454ff;
    box-shadow: 0 0 0 3px rgba(36, 84, 255, 0.1);
}
input[readonly], textarea[readonly] {
    background: #f9fafb;
    color: #4b5563;
}
textarea { resize: vertical; font-family: 'Monaco', 'Menlo', 'Consolas', monospace; font-size: 12px; }
input[type="password"] { font-family: monospace; }

button, .button {
    background: #2454ff;
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    text-decoration: none;
}
button:hover, .button:hover {
    background: #1a3fd4;
    transform: translateY(-1px);
}
.button { width: auto; }
button.secondary, .button.secondary {
    background: #e5e7eb;
    color: #374151;
}
button.secondary:hover, .button.secondary:hover {
    background: #d1d5db;
}
button.danger, .button.danger {
    background: #dc2626;
    color: #fff;
}
button.danger:hover, .button.danger:hover {
    background: #b91c1c;
}
button.small, .button.small {
    padding: 6px 12px;
    font-size: 12px;
}
button[disabled], .button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}
.alert.success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert.error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert.info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert.warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.muted { color: #6b7280; font-size: 14px; }
.text-sm { font-size: 13px; }

.status-box {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 12px;
}
.status-box .error { color: #dc2626; font-weight: 500; }
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}
.status-badge.success { background: #d1fae5; color: #065f46; }
.status-badge.error { background: #fee2e2; color: #991b1b; }
.status-badge.warning { background: #fef3c7; color: #92400e; }
.status-badge.info { background: #dbeafe; color: #1e40af; }

.summary {
    margin-top: 12px;
    font-size: 14px;
    display: grid;
    gap: 6px;
}
.summary div { display: flex; gap: 8px; }
.summary strong { min-width: 100px; color: #4b5563; }

.timing {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
}

.shop-frame {
    width: 100%;
    height: 500px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th {
    padding: 12px;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    text-align: left;
    font-weight: 600;
    color: #374151;
}
td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}
tr:hover td { background: #f9fafb; }

pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.6;
    margin: 0;
}
pre.light {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
}

details {
    margin-top: 8px;
}
details summary {
    cursor: pointer;
    color: #2454ff;
    font-weight: 500;
    padding: 8px 0;
}
details summary:hover { text-decoration: underline; }

.app-footer {
    padding: 16px 24px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 13px;
    text-align: center;
}

.return-page { padding: 24px; max-width: 1200px; margin: 0 auto; }
.hidden { position: absolute; left: -9999px; top: -9999px; }

.copy-btn {
    position: relative;
}
.copy-btn.copied::after {
    content: 'Copied!';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
}

.field-group {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    background: #fafbfc;
}
.field-group label:first-child {
    margin-top: 0;
}

.tooltip {
    position: relative;
    cursor: help;
}
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}
.tooltip:hover::after { opacity: 1; }

/* Validation Panel */
.validation-panel {
    border-left: 4px solid #3b82f6;
}
.validation-panel h3, .validation-panel h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}
.validation-panel h3::before, .validation-panel h2::before {
    content: '✓';
    display: inline-flex;
    width: 22px;
    height: 22px;
    background: #3b82f6;
    color: #fff;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}
.validation-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}
.validation-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.validation-section h4 {
    font-size: 0.95rem;
    margin-bottom: 10px;
    color: #374151;
}
.validation-panel .alert ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}
.validation-panel .alert li {
    margin-bottom: 4px;
}
.validation-panel .alert li:last-child {
    margin-bottom: 0;
}
.alert ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

@media (max-width: 768px) {
    .app-header { flex-direction: column; align-items: flex-start; }
    .grid.two, .grid.three { grid-template-columns: 1fr; }
    .tabs { overflow-x: auto; }
    .row.actions { flex-wrap: wrap; }
}
