* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.toolbar {
    padding: 10px;
    background: #e8e8e8;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

/* NEW: User Info Bar (Row 1) */
.toolbar-user {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 15px;  /* Even more compact - menu bar style */
    background: #f0f0f0;
    border-bottom: 1px solid #d0d0d0;
    font-size: 12px;
}

.toolbar-user-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-user-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Text links (menu-style) */
.text-link {
    color: #333;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 4px;
    transition: color 0.2s, background-color 0.2s;
}

.text-link:hover {
    color: #2196F3;
    background-color: rgba(33, 150, 243, 0.08);
    border-radius: 3px;
}

.menu-separator {
    color: #999;
    font-size: 12px;
}

/* Update usage counter for menu bar style */
.usage-counter {
    background: #e8f5e8;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
}

/* Update trial display for menu bar style */
#trial-display {
    font-size: 11px;
    color: #666;
    padding: 3px 8px;
    background: #fff3e0;
    border-radius: 3px;
    border: 1px solid #ffe0b2;
    white-space: nowrap;
}

.toolbar-top {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.toolbar-bottom {
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 6px 0;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 6px 0;
}

.canvas-container {
    background: #fafafa;
    position: relative;
    margin: 5px;
    border: 2px solid #ddd;
    overflow: hidden;
    flex: 1;
    min-height: 200px;
}

.resize-divider {
    height: 8px;
    background: linear-gradient(to bottom, #e0e0e0, #d0d0d0);
    border-top: 1px solid #bbb;
    border-bottom: 1px solid #bbb;
    cursor: ns-resize;
    position: relative;
    flex-shrink: 0;
}

.resize-divider:hover {
    background: linear-gradient(to bottom, #d0d0d0, #c0c0c0);
}

.resize-divider::after {
    content: "⋯";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #888;
    font-size: 14px;
    letter-spacing: 3px;
}

.table-container {
    background: #f8f8f8;
    border-top: 2px solid #ccc;
    height: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 100px;
}

#canvas-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

#main-canvas {
    position: absolute;
    top: 0;
    left: 0;
}

.selection-box {
    position: fixed;
    border: 2px dashed #ff0000;
    background: rgba(255, 0, 0, 0.1);
    pointer-events: none;
    z-index: 1000;
    display: none;
}



.table-wrapper {
    flex: 1;
    overflow: auto;
    position: relative;
}

.btn {
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 
                0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.btn:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    border-color: #b0b0b0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 
                0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn.active {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border-color: #1565C0;
    box-shadow: 0 3px 6px rgba(33, 150, 243, 0.3), 
                0 1px 3px rgba(33, 150, 243, 0.2);
}

.btn.active:hover {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.4), 
                0 2px 4px rgba(33, 150, 243, 0.3);
}

.nav-btn {
    background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
    color: #333;
    border-color: #d0d0d0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 
                0 1px 2px rgba(0, 0, 0, 0.05);
}

.nav-btn:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    border-color: #b0b0b0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 
                0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.color-dropdown {
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 
                0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.color-dropdown:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    border-color: #b0b0b0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 
                0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-dropdown option {
    font-weight: 600;
}

.color-dropdown option:hover {
    color: inherit !important;
}

/* Shape dropdown styling - matches color dropdown exactly */
.shape-dropdown {
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 
                0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.shape-dropdown:hover {
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    border-color: #b0b0b0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15), 
                0 2px 4px rgba(0, 0, 0, 0.1);
}

.shape-dropdown option {
    font-weight: 600;
}

.shape-dropdown option:hover {
    color: inherit !important;
}

.file-input {
    width: 360px;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 11px;
    background: white;
}

.divider {
    width: 1px;
    height: 24px;
    background: #999;
    margin: 0 8px;
}

.group-label {
    font-size: 10px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.coord-debug {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    z-index: 2000;
    display: none;
    min-width: 350px;
    max-height: 400px;
    overflow-y: auto;
}

.coord-debug div {
    margin: 2px 0;
}

.coord-debug strong {
    color: #ffff00;
}

.dimension-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.dimension-table th,
.dimension-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dimension-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dimension-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.dimension-table th:nth-child(1),
.dimension-table td:nth-child(1) { width: 50px; }
.dimension-table th:nth-child(2),
.dimension-table td:nth-child(2) { width: 50px; }
.dimension-table th:nth-child(3),
.dimension-table td:nth-child(3) { width: 80px; }
.dimension-table th:nth-child(4),
.dimension-table td:nth-child(4) { width: 80px; }
.dimension-table th:nth-child(5),
.dimension-table td:nth-child(5) { width: 80px; }
.dimension-table th:nth-child(6),
.dimension-table td:nth-child(6) { width: 80px; }
.dimension-table th:nth-child(7),
.dimension-table td:nth-child(7) { width: 120px; }
.dimension-table th:nth-child(8),
.dimension-table td:nth-child(8) { width: 150px; }
.dimension-table th:nth-child(9),
.dimension-table td:nth-child(9) { width: 40px; }

.editable-cell {
    cursor: pointer;
    position: relative;
}

.editable-cell:hover {
    background-color: #e8f4f8;
}

.editable-cell input {
    width: 100%;
    border: none;
    background: #fff;
    padding: 4px;
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
}

.editable-cell input:focus {
    outline: 2px solid #2196F3;
    background: #f0f8ff;
}

.action-cell {
    text-align: center;
}

.action-btn {
    padding: 2px 6px;
    margin: 1px;
    font-size: 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: #e0e0e0;
}

.action-btn:hover {
    background: #d0d0d0;
}

.delete-btn {
    background: #ff6b6b;
    color: white;
}

.delete-btn:hover {
    background: #ff5252;
}

#status-message {
    position: fixed;
    bottom: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    display: none;
}

/* ADDED: Fixed width for buttons that change text */
#ai-toggle-btn {
    min-width: 95px; /* Enough for "OCR MODE" with padding and letter-spacing */
    text-align: center;
}

#pause-numbering-btn {
    min-width: 85px; /* Enough for "RESUME #" with padding and letter-spacing */
    text-align: center;
}

/* NEW: Status overlay positioned in top-center of viewport */
.status-overlay {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(128, 128, 128, 0.25);
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    z-index: 150;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    opacity: 0.9;
}

/* Auth Modal */
.auth-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-modal-content {
    background-color: #fff;
    padding: 0;
    border-radius: 8px;
    width: 400px;
    max-width: 90vw;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.auth-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-close:hover {
    color: #333;
}

.auth-modal-body {
    padding: 24px;
}

.auth-error {
    background-color: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 16px;
    border: 1px solid #fcc;
    font-size: 14px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-input-group {
    margin-bottom: 16px;
}

.auth-input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-input-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 16px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 600;
}

.auth-submit-btn:hover {
    background-color: #0056b3;
}

.auth-submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.auth-switch {
    text-align: center;
    color: #666;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
}

.auth-switch-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-switch-btn:hover {
    color: #0056b3;
}

/* Auth Section in Toolbar */
.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sign-in-btn {
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sign-in-btn:hover {
    background-color: #0056b3;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #666;
    font-size: 12px;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.sign-out-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: #666;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sign-out-btn:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.auth-link {
    background: none;
    border: none;
    color: #2196F3;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    font-family: "Proxima Nova", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.auth-link:hover {
    color: #1976D2;
}