:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #10b981;
    --secondary-hover: #059669;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --font-family: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    /* Remove highlight on mobile tap */
}

body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

/* Mobile-first Container */
.app-container {
    width: 100%;
    max-width: 800px;
    /* Tablet/Desktop limit */
    background-color: var(--card-bg);
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    margin: 0;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

header {
    background-color: transparent;
    /* Removed blue background */
    color: #334155;
    /* Dark Gray */
    padding: 20px;
    text-align: center;
    margin-bottom: 25px;
}

header h1 {
    margin: 0;
    font-weight: 800;
    /* Extra bold */
    letter-spacing: -1px;
    font-size: 2.5rem;
}

.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

/* New UX Styles */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.btn-square {
    aspect-ratio: 1;
    /* Square shape */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

.btn-square:active {
    transform: scale(0.95);
}

.btn-square .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    padding: 20px;
    /* Safety padding to prevent edge touching */
    box-sizing: border-box;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 25px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    /* Absolute limits */
    overflow-y: auto;
    /* Internal scrolling */
    border-radius: 16px;
    /* Ensure rounded corners on mobile too if possible, or override below */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.modal-body textarea {
    width: 100%;
    height: 150px;
    margin-bottom: 20px;
    padding: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background-color: #f8fafc;
    font-family: var(--font-family);
    font-size: 1rem;
    resize: none;
    box-sizing: border-box;
    /* Force padding inside width */
    transition: all 0.2s ease;
}

.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.full-width {
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1rem;
}

/* Desktop Modal Style */
@media (min-width: 601px) {
    .modal-content {
        width: 500px;
        border-radius: 16px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    }
}

/* Mobile Modal Style (Fullscreen) */
@media (max-width: 600px) {
    .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .modal-header {
        margin-top: 10px;
    }
}

.hidden {
    display: none;
}

.primary {
    background-color: var(--secondary-color);
}

.secondary {
    background-color: #334155;
}

.table-wrapper {
    overflow-x: auto;
    /* Scroll horizontally if needed */
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: none;
}

.text-right {
    text-align: right;
}

tfoot {
    background-color: #f8fafc;
}

/* Zebra striping for readability */
tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

/* Mobile Tweaks */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    .buttons-row {
        flex-direction: row;
        /* Keep 50/50 on mobile */
    }

    th,
    td {
        padding: 0.5rem 0.25rem;
        /* Less padding */
        font-size: 0.75rem;
        /* Smaller text for mobile */
    }

    /* Prevent date wrapping */
    td[data-field="date"] {
        white-space: nowrap;
        font-size: 0.7rem;
        /* Even smaller for date if needed to fit */
    }
}

/* FAB Container Top-Right */
.fab-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    z-index: 900;
}

.fab {
    position: static;
    /* Controlled by container */
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    /* Slightly larger icon since no bg */
    border-radius: 50%;
    background-color: transparent;
    color: #334155;
    /* Dark gray to be visible against white header/bg */
    border: none;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

.fab:hover {
    background-color: rgba(0, 0, 0, 0.05);
    /* Subtle gray on hover */
    transform: scale(1.1);
}

/* Settings Modal Specifics */
/* Main Buttons General */
.btn {
    padding: 15px;
    /* Default padding for main buttons */
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    /* Larger text requested */
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    color: white !important;
    /* Force white text */
}

.primary {
    background-color: var(--secondary-color);
    color: white;
}

.secondary {
    background-color: #334155;
    color: white;
}

/* Specific fix for settings buttons (narrower/less tall) */
.settings-content .btn {
    padding: 10px;
    /* Reduced padding */
    font-size: 1rem;
    height: auto;
    /* Let content dictate height */
}

.settings-input {
    width: 100%;
    min-height: 100px;
    margin-bottom: 20px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.95rem;
    /* Slightly larger input text */
    resize: vertical;
    background: #f8fafc;
}

/* Ensure prompt profile buttons are also white text */
#activateProfile,
#deleteProfile {
    color: white !important;
}