body {
    background: #f6f8fc;
    font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
    color: #202124;
    margin: 0;
}
.contacts-widget,
.contacts-form-container,
.upload-container,
.contact-details-widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(60,64,67,.15);
    max-width: 600px;
    margin: 48px auto;
    padding: 32px 32px;
}
.contacts-widget h3,
.contact-details-widget h3,
.upload-container h2,
.contacts-form-container h2 {
    margin-top: 0;
    margin-bottom: 0;
    color: #1a73e8;
    font-size: 2em;
    font-weight: 500;
    letter-spacing: 0.5px;
}
.contacts-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    overflow-y: auto;
    flex: 1;
    display: block;
}
.contacts-table th, .contacts-table td {
    padding: 14px 12px;
    text-align: left;
    font-size: 1em;
    overflow: hidden;
    text-overflow: ellipsis;
}
.contacts-table td.burger-menu-cell {
  overflow: visible;
}
.contacts-table thead,
.contacts-table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}
.contacts-table thead {
    width: calc(100% - 17px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.contacts-table th {
    background: #f1f3f4;
    color: #5f6368;
    font-weight: 500;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.contacts-table tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}
.contacts-table tr:last-child {
    border-bottom: none;
}
.contacts-table td {
    color: #202124;
    vertical-align: middle;
}
.contacts-table tr:hover {
    background: #eaf1fb;
    cursor: pointer;
}
.contacts-table tr th:hover {
    background: #f1f3f4;
    cursor: default;
}
.contacts-actions a, .contacts-actions button {
    background: #e8f0fe;
    border: none;
    color: #1a73e8;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.97em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
}
.contacts-actions a:hover, .contacts-actions button:hover {
    background: #1a73e8;
    color: #fff;
}
.add-contact-btn {
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    margin-top: 24px;
    transition: background 0.2s;
    box-shadow: 0 1px 2px rgba(60,64,67,.15);
}
.add-contact-btn:hover {
    background: #1765c1;
}
.contacts-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 0;
}
.contacts-form input, .contacts-form textarea {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: #f6f8fc;
    color: #202124;
    transition: border 0.2s;
}
.contacts-form input:focus, .contacts-form textarea:focus {
    border-color: #1a73e8;
    outline: none;
    background: #fff;
}
.contacts-form button[type="submit"] {
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    margin-right: 8px;
    transition: background 0.2s;
    box-shadow: 0 1px 2px rgba(60,64,67,.15);
}
.contacts-form button[type="submit"]:hover {
    background: #1765c1;
}
.contacts-form .cancel-link {
    color: #1a73e8;
    text-decoration: none;
    margin-left: 10px;
    font-size: 0.97em;
}
.contacts-form .cancel-link:hover {
    text-decoration: underline;
}
.upload-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(60,64,67,.15);
    max-width: 600px;
    margin: 48px auto;
    padding: 32px 32px;
    color: #202124;
}
.file-list {
    margin-top: 18px;
}
.file-list li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.file-list img {
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(60,64,67,.15);
    background: #f1f3f4;
    padding: 2px;
}
.back-link {
    color: #1a73e8;
    text-decoration: none;
    margin-top: 24px;
    display: inline-block;
    font-weight: 500;
}
.back-link:hover {
    text-decoration: underline;
}
.contact-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 18px;
    background: #fff;
}
.contact-details-table th, .contact-details-table td {
    padding: 12px 10px;
    text-align: left;
    font-size: 1em;
}
.contact-details-table th {
    background: #f1f3f4;
    color: #5f6368;
    font-weight: 500;
    border-bottom: 2px solid #e0e0e0;
    width: 140px;
}
.contact-details-table td {
    color: #202124;
}
.contact-details-widget a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}
.contact-details-widget a:hover {
    text-decoration: underline;
}
::-webkit-input-placeholder { color: #5f6368; }
::-moz-placeholder { color: #5f6368; }
:-ms-input-placeholder { color: #5f6368; }
::placeholder { color: #5f6368; }

/* Google Contacts-like Header */
.gc-header {
    width: 100%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(60,64,67,.10);
    padding: 0 16px;
    display: flex;
    align-items: center;
    height: 64px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    vertical-align: middle;
}

.gc-header-logo {
    font-size: 2.2em;
    font-weight: 700;
    color: #1a73e8;
    letter-spacing: 1px;
    margin-right: 72px;
}
.gc-header-search {
    flex: 1;
    display: flex;
    align-items: center;
    height: 36px;
    width: 100%;
    margin-right: 20px;
}
.gc-header-search input {
    width: 100%;
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid #e0e0e0;
    background: #f1f3f4;
    font-size: 1em;
    outline: none;
    transition: border 0.2s;
}
.gc-header-search input:focus {
    border-color: #1a73e8;
    background: #fff;
}
.gc-header-export {
    margin-left: 16px;
    margin-right: 16px;
}
.gc-export-btn {
    background: #34a853;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 1px 2px rgba(60,64,67,.15);
}
.gc-export-btn:hover {
    background: #2d8f47;
}
.gc-header-settings {
    margin-right: 40px;
}
.gc-header-settings:hover {
    background: #d2e3fc;
}

.gc-header-birthdays {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e8f0fe;
    transition: background 0.2s;
    margin-right: 16px;
    cursor: pointer;
}

/* Google Contacts-like Sidebar */
.gc-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 280px;
    height: calc(100vh - 64px);
    background: #fff;
    box-shadow: 1px 0 4px rgba(60,64,67,.10);
    padding: 32px 0 0 0;
    display: flex;
    flex-direction: column;
    z-index: 99;    
}
.gc-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 24px;
    overflow-y: auto;
}
.gc-sidebar-nav a {
    color: #202124;
    text-decoration: none;
    font-size: 1.08em;
    padding: 10px 18px;
    border-radius: 24px 0 0 24px;
    transition: background 0.2s, color 0.2s;
    font-weight: 500;
}
.gc-sidebar-nav a.active,
.gc-sidebar-nav a:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

/* Main content area adjustment for sidebar/header */
.gc-main {
    margin-left: 280px;
    margin-top: 64px;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
}

.gc-main-full {
    margin-top: 64px;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
}

/* Make contacts widget full width and height within the main area */
.contacts-widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(60,64,67,.15);
    max-width: none;
    margin: 32px 32px;
    padding: 32px 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Ensure table headers and rows display properly when table is block */
.contacts-table thead,
.contacts-table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.contacts-table thead {
    width: calc(100% - 17px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.contacts-table th {
    background: #f1f3f4;
    color: #5f6368;
    font-weight: 500;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Make form container full width and height within the main area when inside gc-main */
.gc-main .contacts-form-container,
.gc-main .upload-container,
.gc-main-full .contact-details-widget,
.gc-main .contact-details-widget {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(60,64,67,.15);
    max-width: none;
    margin: 32px 32px;
    padding: 32px 32px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Form container with fixed header and footer */
.contacts-form-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.contacts-form-container h2 {
    flex-shrink: 0;
    margin-bottom: 20px;
}

.form-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 20px;
}

.form-buttons {
    flex-shrink: 0;
    padding: 20px 0 0 0;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 16px;
}

.form-buttons button[type="submit"] {
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(60,64,67,.3);
    min-width: 100px;
}

.form-buttons button[type="submit"]:hover {
    background: #1765c1;
    box-shadow: 0 2px 6px rgba(60,64,67,.4);
}

.form-buttons button[type="submit"]:active {
    background: #1557b0;
    box-shadow: 0 1px 2px rgba(60,64,67,.3);
}

.form-buttons .cancel-link {
    color: #1a73e8;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 24px;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.form-buttons .cancel-link:hover {
    background: #f8f9fa;
    text-decoration: none;
    border-color: #e0e0e0;
}

.form-buttons .cancel-link:active {
    background: #f1f3f4;
}

/* Burger Menu Styles */
.burger-menu {
    position: relative;
    display: inline-block;
}

.burger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border-radius: 20px;
    transition: background 0.2s;
    height: 32px;
    justify-content: center;
    align-items: center;
}

.burger-btn:hover {
    background: #f1f3f4;
}

.burger-btn span {
    width: 16px;
    height: 2px;
    background: #5f6368;
    border-radius: 1px;
    transition: all 0.2s;
}

.burger-btn:hover span {
    background: #fff;
}

.burger-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(60,64,67,.15);
    z-index: 1000;
    min-width: 120px;
    padding: 4px 0;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.95em;
    color: #202124;
    transition: background 0.2s;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1.4;
    font-family: inherit;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: #f1f3f4;
    text-decoration: none;
}

.dropdown-item.delete-item {
    color: #d73027;
}

.dropdown-item.delete-item:hover {
    background: #d73027;
    color: #f1f3f4;
}

.contacts-actions a svg {
    vertical-align: middle;
    margin-bottom: 3px;
}

/* Column width controls */
.contacts-table th:nth-child(1) { width: 48px; min-width: 48px; max-width: 48px; } /* Picture */
.contacts-table th:nth-child(2) { width: 200px; min-width: 200px; } /* Name */
.contacts-table th:nth-child(3) { width: 15%; min-width: none; } /* Email */
.contacts-table th:nth-child(4) { width: 15%; min-width: none; } /* Phone */
.contacts-table th:nth-child(5) { width: 15%; min-width: none; } /* Company */
.contacts-table th:nth-child(6) { width: 180px; min-width: 80px; } /* Labels */
.contacts-table th:nth-child(7) { width: 100px; min-width: 100; } /* Actions */

/* Hide actions by default */
.contacts-actions {
    display: flex;
    gap: 8px;
    pointer-events: auto;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

/* Show actions when hovering the row */
.contacts-table tr:hover .contacts-actions {
    opacity: 1;
}

/* Make sure actions don't overflow */
.contacts-actions a,
.contacts-actions .burger-menu {
    flex-shrink: 0;
}

/* Labels styling */
.labels-field {
    position: relative;
}

.existing-labels {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
}

.existing-labels small {
    color: #5f6368;
    font-size: 0.9em;
    display: block;
    margin-bottom: 6px;
}

.label-suggestion {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 4px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s;
}

.label-suggestion:hover {
    background: #1a73e8;
    color: #fff;
}

.contact-label {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 3px 8px;
    margin: 1px 3px 1px 0;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 500;
}

/* Sidebar labels section */
.sidebar-section {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e8eaed;
}

.sidebar-section h4 {
    color: #5f6368;
    font-size: 0.9em;
    font-weight: 500;
    margin: 0 0 8px 0;
    padding: 0 18px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.label-filter {
    color: #202124;
    text-decoration: none;
    font-size: 0.95em;
    padding: 6px 18px;
    border-radius: 24px 0 0 24px;
    transition: background 0.2s, color 0.2s;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 8px;
}

.label-filter.active,
.label-filter:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

.label-icon {
    font-size: 0.9em;
    opacity: 0.7;
}

.dropdown-btn {
    border-radius: 0px !important;
}
.form-header-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    min-height: 38px;
}
.form-header-buttons .back-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e8f0fe;
    border: none;
    text-decoration: none;
    transition: background 0.2s;
}
.form-header-buttons .back-arrow:hover {
    background: #d2e3fc;
}
.form-header-buttons .save-btn {
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 7px 18px;
    border-radius: 18px;
    font-size: 0.97em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-left: auto;
}
.form-header-buttons .save-btn:hover {
    background: #1765c1;
    text-decoration: none !important;
}

/* Settings page */
#language, #css, #contacts_sort, #labels_sort, #date_format, #trash_retention_days, #allowed_extensions,
#api_token, #generate_api_token, #widget_token, #generate_widget_token,
#mail_method {
    padding: 8px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    background: #f6f8fc;
    color: #202124;
    transition: border 0.2s;
    /* margin-left: 8px; */
    min-width: 120px;
    outline: none;
}
#language:focus, #css:focus, #contacts_sort:focus, #labels_sort:focus, #date_format:focus, #trash_retention_days:focus, #allowed_extensions:focus,
#api_token:focus, #generate_api_token:focus, #widget_token:focus, #generate_widget_token:focus,
#mail_method:focus {
    border-color: #1a73e8;
    background: #fff;
}
.settings-label {
    font-weight: 500;
    color: #1a73e8;
    margin-right: 8px;
}

/* Checkbox for row selection */
/* Center the checkbox in the middle of the cell */
.contact-picture-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
}
.contact-select-checkbox {
    position: static;
    width: 24px;
    height: 24px;
    margin: 0;
    z-index: 2;
    cursor: pointer;
}
.contact-picture {
    display: inline-block;
    width: 40px;
    height: 40px;
    vertical-align: middle;
}

/* Show checkbox, hide picture on row hover or if selected */
.contacts-table tr:hover .contact-picture,
.contacts-table tr.selected .contact-picture {
    display: none;
}
.contacts-table tr:hover .contact-select-checkbox,
.contacts-table tr.selected .contact-select-checkbox {
    display: inline-block !important;
}

/* Plus label button hover effect matches .label-suggestion */
.plus-label-btn {
    display: inline-flex;
    align-items: center;
    border: none;
    gap: 5px;
    background: #e8f0fe;
    color: #1a73e8;
    padding: 4px 8px;
    margin: 10px 4px 2px 0;
    border-radius: 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s;
}

.plus-label-btn:hover {
    background: #1a73e8;
    color: #fff;
}

.plus-label-btn:hover svg path {
    stroke: #fff;
}