/* FlowUpdater Admin — design system
   A calm, glassy green palette. Cards, buttons, inputs, tables, badges and modals
   all draw from the same tokens so every screen reads as one system. */

:root {
    --fu-primary-900: #0d2f22;
    --fu-primary-800: #123a2b;
    --fu-primary-700: #1a5c42;
    --fu-primary-600: #1f7a56;
    --fu-primary-500: #2b9c6f;
    --fu-primary-400: #4cb98a;
    --fu-primary-300: #8fd8b6;
    --fu-primary-100: #e6f6ee;

    --fu-accent-500: #2f9e8f;
    --fu-amber-500: #dd9a2b;
    --fu-red-500: #d5504a;
    --fu-gray-900: #1e2624;
    --fu-gray-700: #445048;
    --fu-gray-500: #74827a;
    --fu-gray-300: #d7e0db;
    --fu-gray-100: #f3f7f5;

    --fu-surface: #ffffff;
    --fu-page-bg: #eef4f1;
    --fu-border: #dde7e2;

    --fu-radius-sm: 8px;
    --fu-radius-md: 14px;
    --fu-radius-lg: 20px;

    --fu-shadow-sm: 0 1px 2px rgba(13, 47, 34, 0.06), 0 1px 1px rgba(13, 47, 34, 0.04);
    --fu-shadow-md: 0 8px 24px rgba(13, 47, 34, 0.10), 0 2px 6px rgba(13, 47, 34, 0.06);
    --fu-shadow-lg: 0 20px 45px rgba(13, 47, 34, 0.18);
}

body {
    background: var(--fu-page-bg);
    color: var(--fu-gray-900);
}

/* ---------- Page layout ---------- */

.app-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.app-page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--fu-primary-800);
    margin: 0 0 0.15rem 0;
}

.app-page-header .app-page-subtitle {
    color: var(--fu-gray-500);
    font-size: 0.95rem;
    margin: 0;
}

.app-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--fu-primary-600);
    font-size: 0.9rem;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.app-breadcrumb:hover {
    text-decoration: underline;
}

/* ---------- Cards ---------- */

.app-card {
    background: var(--fu-surface);
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius-lg);
    box-shadow: var(--fu-shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.app-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fu-primary-800);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------- Buttons ---------- */

.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid transparent;
    border-radius: var(--fu-radius-sm);
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.05s ease, box-shadow 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
    line-height: 1.2;
}

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

.app-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.app-btn-primary {
    background: linear-gradient(135deg, var(--fu-primary-600), var(--fu-primary-500));
    color: #fff;
    box-shadow: var(--fu-shadow-sm);
}

.app-btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(31, 122, 86, 0.35);
}

.app-btn-secondary {
    background: var(--fu-gray-100);
    color: var(--fu-gray-900);
    border-color: var(--fu-border);
}

.app-btn-secondary:hover:not(:disabled) {
    background: var(--fu-gray-300);
}

.app-btn-danger {
    background: #fdf1f0;
    color: var(--fu-red-500);
    border-color: #f6d3d1;
}

.app-btn-danger:hover:not(:disabled) {
    background: var(--fu-red-500);
    color: #fff;
}

.app-btn-ghost {
    background: transparent;
    color: var(--fu-primary-700);
}

.app-btn-ghost:hover:not(:disabled) {
    background: var(--fu-primary-100);
}

.app-btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.app-btn-icon {
    padding: 0.4rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 999px;
}

/* ---------- Forms ---------- */

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

.app-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.app-field label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--fu-gray-700);
}

.app-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.app-input-group .app-input-icon {
    position: absolute;
    left: 0.85rem;
    color: var(--fu-gray-500);
    display: inline-flex;
}

.app-input-group .app-input,
.app-input-group .app-select {
    padding-left: 2.4rem;
}

.app-input-group .app-input.app-input-with-toggle {
    padding-right: 2.6rem;
}

.app-input-toggle {
    position: absolute;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border: none;
    background: transparent;
    color: var(--fu-gray-500);
    cursor: pointer;
    border-radius: 999px;
}

.app-input-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--fu-gray-900);
}

.login-card .app-input-toggle {
    color: rgba(0, 0, 0, 0.55);
}

.login-card .app-input-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
}

.app-input,
.app-select,
.app-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--fu-border);
    border-radius: var(--fu-radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.92rem;
    background: var(--fu-gray-100);
    color: var(--fu-gray-900);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.app-textarea {
    resize: vertical;
    min-height: 4.5rem;
}

.app-input:focus,
.app-select:focus,
.app-textarea:focus {
    outline: none;
    border-color: var(--fu-primary-500);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(43, 156, 111, 0.18);
}

.app-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    color: var(--fu-gray-700);
}

.app-form-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.app-picker-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-picker-row .app-select {
    flex: 1;
}

/* ---------- Toolbar ---------- */

.app-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-toolbar .app-field {
    margin-bottom: 0;
    min-width: 160px;
}

/* ---------- Table / grid ---------- */

.app-table-wrapper {
    overflow-x: auto;
    border-radius: var(--fu-radius-md);
    border: 1px solid var(--fu-border);
}

table.app-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--fu-surface);
    font-size: 0.9rem;
}

table.app-table thead th {
    text-align: left;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--fu-gray-500);
    background: var(--fu-gray-100);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--fu-border);
    white-space: nowrap;
}

table.app-table tbody td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--fu-border);
    vertical-align: middle;
    color: var(--fu-gray-900);
}

table.app-table tbody tr:last-child td {
    border-bottom: none;
}

table.app-table tbody tr:hover {
    background: var(--fu-primary-100);
}

table.app-table .app-table-actions {
    display: flex;
    gap: 0.35rem;
    justify-content: flex-end;
}

.app-table-link {
    color: var(--fu-primary-700);
    font-weight: 600;
    text-decoration: none;
}

.app-table-link:hover {
    text-decoration: underline;
}

.app-empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--fu-gray-500);
}

.app-loading {
    padding: 2rem;
    text-align: center;
    color: var(--fu-gray-500);
}

/* ---------- Badges ---------- */

.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-badge-green { background: #e4f6ec; color: var(--fu-primary-700); }
.app-badge-amber { background: #fbf1de; color: #93670f; }
.app-badge-red { background: #fbe7e6; color: #a8342d; }
.app-badge-gray { background: var(--fu-gray-100); color: var(--fu-gray-700); }
.app-badge-blue { background: #e5f1fb; color: #1c5f96; }

/* ---------- Alerts ---------- */

.app-alert {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-radius: var(--fu-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.app-alert-error {
    background: #fdf1f0;
    color: #a8342d;
    border: 1px solid #f6d3d1;
}

/* ---------- Modal ---------- */

.app-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 47, 34, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1050;
}

.app-modal {
    background: var(--fu-surface);
    border-radius: var(--fu-radius-lg);
    box-shadow: var(--fu-shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: app-modal-in 0.15s ease-out;
}

@keyframes app-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--fu-border);
}

.app-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--fu-primary-800);
}

.app-modal-close {
    border: none;
    background: transparent;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--fu-gray-500);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
}

.app-modal-close:hover {
    background: var(--fu-gray-100);
    color: var(--fu-gray-900);
}

.app-modal-body {
    padding: 1.4rem;
}

/* ---------- Dashboard shortcuts (Home) ---------- */

.app-shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
}

.app-shortcut-card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.5rem;
    border-radius: var(--fu-radius-lg);
    background: linear-gradient(155deg, var(--fu-primary-700), var(--fu-primary-500));
    color: #fff;
    text-decoration: none;
    box-shadow: var(--fu-shadow-md);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-shortcut-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--fu-shadow-lg);
    color: #fff;
}

.app-shortcut-card .app-shortcut-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.app-shortcut-card h2 {
    margin: 0;
    font-size: 1.15rem;
}

.app-shortcut-card p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ---------- Login ---------- */

.login-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 15% 20%, rgba(76, 185, 138, 0.55), transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(43, 156, 111, 0.4), transparent 40%),
        radial-gradient(circle at 30% 85%, rgba(13, 47, 34, 0.8), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(31, 122, 86, 0.55), transparent 45%),
        linear-gradient(160deg, #0d2f22 0%, #123a2b 55%, #1a5c42 100%);
    overflow: hidden;
}

.login-page::before {
    content: "";
    position: absolute;
    inset: -10%;
    background: inherit;
    filter: blur(60px);
    opacity: 0.9;
    z-index: 0;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    padding: 3.75rem 2.25rem 2.25rem 2.25rem;
    border-radius: var(--fu-radius-lg);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: var(--fu-shadow-lg);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    color: #fff;
    text-align: center;
}

.login-avatar {
    position: absolute;
    top: -2.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 999px;
    background: var(--fu-primary-900);
    border: 3px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--fu-shadow-md);
}

.login-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
    letter-spacing: 0.01em;
}

.login-card .app-field {
    text-align: left;
}

.login-card .app-field label {
    color: rgba(255, 255, 255, 0.85);
}

.login-card .app-input-group .app-input-icon {
    color: rgba(0, 0, 0, 0.55);
}

.login-card .app-input {
    background: rgba(255, 255, 255, 0.85);
    border: none;
    color: var(--fu-gray-900);
}

.login-card .app-input:focus {
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    margin: 0.25rem 0 1.5rem 0;
}

.login-options .app-checkbox-row {
    color: rgba(255, 255, 255, 0.85);
}

.login-forgot {
    color: rgba(255, 255, 255, 0.65);
    font-style: italic;
    cursor: default;
    text-decoration: none;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--fu-radius-sm);
    border: none;
    background: var(--fu-primary-900);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease;
}

.login-btn:hover:not(:disabled) {
    background: #082018;
}

.login-btn:active:not(:disabled) {
    transform: translateY(1px);
}

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

.login-error {
    background: rgba(213, 80, 74, 0.25);
    border: 1px solid rgba(213, 80, 74, 0.5);
    color: #fff;
    border-radius: var(--fu-radius-sm);
    padding: 0.55rem 0.8rem;
    font-size: 0.82rem;
    margin-bottom: 1rem;
}
