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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.header h1 {
    color: #333;
    font-size: 24px;
    margin-bottom: 10px;
}

.config-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.config-section label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.domain-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.domain-input-group input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.domain-input-group button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.domain-input-group button:hover {
    background: #218838;
}

.jwt-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.jwt-section input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.jwt-section button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.jwt-section button:hover {
    background: #5568d3;
}

.jwt-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.jwt-status.valid {
    background: #d4edda;
    color: #155724;
}

.jwt-status.invalid {
    background: #f8d7da;
    color: #721c24;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.card h2 {
    color: #333;
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.recording-controls {
    text-align: center;
}

.timer {
    font-size: 48px;
    font-weight: 300;
    color: #667eea;
    margin: 20px 0;
    font-variant-numeric: tabular-nums;
}

.status-indicator {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.status-idle {
    background: #e0e0e0;
    color: #666;
}

.status-recording {
    background: #ff4444;
    color: white;
    animation: pulse 1.5s infinite;
}

.status-processing {
    background: #ffa500;
    color: white;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.control-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ff4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #cc0000;
    transform: translateY(-2px);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    background: #f0f0f0;
    border: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-weight: 600;
    color: #666;
}

.tab.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.transcript-area {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.transcript-input {
    width: 100%;
    min-height: 170px;
    max-height: 370px;
    border: none;
    background: transparent;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: inherit;
}

.transcript-input:focus {
    outline: none;
}

.transcript-input[readonly] {
    color: #666;
    cursor: not-allowed;
}

.transcript-input:disabled {
    color: #888;
    cursor: wait;
}

.transcript-area.empty .transcript-input {
    color: #999;
    font-style: italic;
}

.transcript-area.empty {
    color: #999;
    font-style: italic;
}

.transcript-segment {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.transcript-final {
    border-left-color: #4caf50;
}

.error-banner {
    background: #ff4444;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.error-banner.show {
    display: block;
}

.error-banner strong {
    display: block;
    margin-bottom: 5px;
}

.log-container {
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-radius: 3px;
}

.log-info {
    color: #4fc3f7;
}

.log-error {
    color: #ff5252;
    background: rgba(255, 82, 82, 0.1);
}

.log-success {
    color: #69f0ae;
}

.log-warning {
    color: #ffd54f;
}

.download-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-update {
    background: #17a2b8;
    color: white;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
}

.btn-update:hover:not(:disabled) {
    background: #138496;
}

.btn-update:disabled {
    background: #9acfd6;
    cursor: not-allowed;
    color: #f1f9fb;
}

.full-width {
    grid-column: 1 / -1;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.auto-stop-message {
    margin-top: 15px;
    padding: 12px 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    font-size: 14px;
    color: #92400e;
    display: none;
    text-align: left;
}

.auto-stop-message.visible {
    display: block;
}

.stat-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.sessions-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.header-subtitle {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

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

.helper-text {
    font-size: 11px;
    color: #888;
    margin-top: 5px;
}

.session-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.session-tabs .tab {
    flex: 1;
    text-align: center;
}

.tab-panels {
    width: 100%;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.summary-result {
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    background: #fafbff;
    margin-top: 10px;
}

.summary-output {
    white-space: pre-wrap;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    min-height: 140px;
    font-family: inherit;
    line-height: 1.4;
    margin-bottom: 15px;
}

.summary-sessions ul {
    margin: 0;
    padding-left: 20px;
}

.summary-sessions li {
    margin-bottom: 6px;
    color: #444;
}

.section-summary {
    font-size: 14px;
    color: #555;
    margin-bottom: 12px;
}

.result-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-empty {
    text-align: center;
    color: #777;
    font-style: italic;
    padding: 20px;
    background: #f8f8f8;
    border-radius: 8px;
}

.session-item {
    border: 1px solid #e3e3e3;
    border-radius: 10px;
    padding: 16px;
    background: #fafafa;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.session-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.session-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    background: #eef0fb;
    color: #4a4ebf;
}

.tag-status {
    background: #e0f2f1;
    color: #00695c;
}

.tag-type {
    background: #f3e5f5;
    color: #6a1b9a;
}

.session-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: #555;
    margin-bottom: 12px;
}

.meta-item {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.meta-item strong {
    font-weight: 600;
    margin-right: 4px;
    color: #333;
}

.session-transcript {
    background: #ffffff;
    border: 1px solid #ececec;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
    max-height: 8rem;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}

.session-transcript::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 90%);
}

.session-transcript.empty {
    color: #888;
    font-style: italic;
    border-style: dashed;
}

.session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-start;
}

.icon-button {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: none;
    background: #eef0fb;
    color: #4a4ebf;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.icon-button svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.icon-button:hover:not(:disabled) {
    background: #dfe2ff;
    transform: translateY(-1px);
}

.icon-button:disabled {
    background: #f1f1f5;
    color: #a0a3c2;
    cursor: not-allowed;
}

.icon-button.loading {
    opacity: 0.6;
    cursor: wait;
}

.icon-button.danger {
    background: #ffe8e6;
    color: #c62828;
}

.icon-button.danger:hover:not(:disabled) {
    background: #ffd1ce;
}

.icon-button.danger:disabled {
    background: #fbe5e3;
    color: #e0a3a0;
}

.session-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
}

.result-meta {
    font-size: 13px;
    color: #333;
    background: #e8f5e9;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
}

.result-note {
    font-size: 13px;
    color: #555;
    margin-top: 8px;
}

.sr-only {
    border: 0;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
}
