/* =============================================
   PROTULS — Light Minimal Theme
   ============================================= */

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

:root {
    --bg:          #F5F5F7;
    --surface:     #FFFFFF;
    --border:      #D2D2D7;
    --border-2:    #ABABAF;
    --text:        #1C1C1E;
    --text-muted:  #6E6E73;
    --danger:      #FF3B30;
    --success:     #248A3D;
    --header-h:    54px;
    --r-sm:        8px;
    --r-md:        12px;
    --r-lg:        16px;
    --font:        'Inter', system-ui, -apple-system, sans-serif;
    --t:           0.14s ease;
}

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ---- HEADER ---- */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: rgba(245, 245, 247, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}

.header-actions { display: flex; align-items: center; }

/* ---- LOGIN BUTTON ---- */
.btn-login {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    transition: background var(--t), border-color var(--t);
    cursor: pointer;
}
.btn-login:hover {
    background: #EBEBED;
    border-color: var(--border-2);
}

/* ---- ICON BUTTON (gear) ---- */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: background var(--t), color var(--t);
}
.icon-btn:hover,
.icon-btn[aria-expanded="true"] {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

/* ---- USER MENU / DROPDOWN ---- */
.user-menu { position: relative; }

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 176px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
    padding: 5px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px) scale(0.98);
    transform-origin: top right;
    transition: opacity var(--t), transform var(--t);
    z-index: 200;
}
.dropdown.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.dropdown-item {
    display: block;
    padding: 7px 10px;
    font-size: 0.84rem;
    font-weight: 400;
    color: var(--text);
    border-radius: var(--r-sm);
    transition: background var(--t);
    cursor: pointer;
}
.dropdown-item:hover      { background: var(--bg); }
.dropdown-item--danger    { color: var(--danger); }
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 2px;
}

/* ---- MAIN ---- */
.main {
    padding: clamp(28px, 6vw, 48px) 24px;
    display: flex;
    justify-content: center;
}

/* ---- TILES ---- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 280px));
    gap: 16px;
    justify-content: center;
    width: 100%;
    max-width: 960px;
}

.tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    color: var(--text);
    cursor: pointer;
    aspect-ratio: 1;
    transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.tile:only-child {
    width: min(100%, 320px);
    justify-self: center;
}
.tile:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: var(--border-2);
}
.tile:active { transform: translateY(0); box-shadow: none; }

.tile__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--c, #000) 10%, transparent);
    color: var(--c, #000);
    flex-shrink: 0;
}
.tile__icon svg { width: 22px; height: 22px; }

.tile__info { display: flex; flex-direction: column; gap: 3px; }

.tile__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}
.tile__desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 640px) {
    .main {
        padding-inline: 16px;
    }

    .tiles {
        grid-template-columns: minmax(0, 1fr);
        max-width: 360px;
    }

    .tile {
        aspect-ratio: auto;
        min-height: 220px;
    }
}

/* ---- AUTH PAGES (login, settings) ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
    font-family: var(--font);
}

.auth-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px 32px;
}

.auth-card__logo {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
    display: block;
    margin-bottom: 28px;
}

.auth-card__title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin-bottom: 24px;
    color: var(--text);
}

.auth-card__sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: -16px;
    margin-bottom: 22px;
}

/* Form */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

label {
    font-size: 0.79rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
    -webkit-appearance: none;
}
input:focus {
    border-color: var(--text);
    box-shadow: 0 0 0 3px rgba(28, 28, 30, 0.07);
}

.btn-submit {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 10px;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--text);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: opacity var(--t);
}
.btn-submit:hover  { opacity: 0.82; }
.btn-submit:active { opacity: 0.65; }

.alert {
    padding: 9px 12px;
    border-radius: var(--r-sm);
    font-size: 0.83rem;
    margin-bottom: 16px;
    line-height: 1.5;
}
.alert--error {
    background: rgba(255, 59, 48, 0.07);
    color: var(--danger);
    border: 1px solid rgba(255, 59, 48, 0.18);
}
.alert--success {
    background: rgba(52, 199, 89, 0.07);
    color: var(--success);
    border: 1px solid rgba(52, 199, 89, 0.18);
}

.auth-back {
    display: inline-block;
    margin-top: 18px;
    font-size: 0.79rem;
    color: var(--text-muted);
    transition: color var(--t);
}
.auth-back:hover { color: var(--text); }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .header  { padding: 0 16px; }
    .main    { padding: 32px 16px; }
    .tiles   { grid-template-columns: repeat(auto-fill, 160px); gap: 12px; }
    .auth-card { padding: 28px 20px; border-radius: 16px; }
}
