@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --green: #7AB51D;
    --green-hover: #6a9e18;
    --green-dark: #5a8714;
    --green-light: #f0f8e4;
    --green-lighter: #f7faf0;

    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-hover: #f9fafb;
    --sidebar: #1e2128;
    --sidebar-hover: #2a2e38;
    --sidebar-active: #333842;

    --danger: #e5483e;
    --danger-hover: #cc3d34;
    --danger-light: #fef2f1;
    --success: #2eae65;
    --success-light: #edfaf2;
    --warning: #e5a11c;
    --warning-light: #fef9ee;
    --info-light: #eef6ff;

    --text: #1a1d23;
    --text-sec: #5f6572;
    --text-muted: #959ba6;
    --border: #e2e5ea;
    --border-light: #eef0f3;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 6px rgba(0,0,0,0.04), 0 10px 24px rgba(0,0,0,0.06);
    --ease: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* === LOGIN === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e2128 0%, #2a2e38 100%);
    padding: 20px;
}
.login-box {
    background: var(--surface);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo img {
    height: 60px;
    width: auto;
}
.login-logo .login-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 16px;
}
.login-logo .login-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--ease);
}
.sidebar-brand {
    padding: 20px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 14px;
}
.sidebar-brand img {
    height: 36px;
    width: auto;
}
.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}
.sidebar-brand .brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #fff;
    text-decoration: none;
    line-height: 1.2;
}
.sidebar-brand .brand-sub {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.02em;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 450;
    transition: all var(--ease);
}
.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,0.85);
}
.sidebar-nav a.active {
    background: var(--green);
    color: #fff;
}
.sidebar-nav a .nav-icon {
    width: 19px; height: 19px;
    opacity: 0.65; flex-shrink: 0;
}
.sidebar-nav a.active .nav-icon { opacity: 1; }
.nav-section {
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.22);
    padding: 20px 14px 8px;
}

.sidebar-user {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user .user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.72rem;
}
.sidebar-user .user-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}
.sidebar-user .user-role {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.35);
}
.sidebar-user .logout-btn {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,0.3);
    padding: 4px;
    transition: color var(--ease);
}
.sidebar-user .logout-btn:hover { color: rgba(255,255,255,0.7); }

/* === MAIN === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 36px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0; z-index: 50;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; }
.topbar-left { display: flex; align-items: center; gap: 12px; }

.page-content {
    flex: 1;
    padding: 28px 36px 48px;
    max-width: 1000px;
    width: 100%;
}

.hamburger {
    display: none;
    background: none; border: none;
    color: var(--text); cursor: pointer; padding: 4px;
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 99;
}

/* === CARDS === */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h3 { font-size: 0.92rem; font-weight: 600; }
.card-body { padding: 22px; }
.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border-light);
    background: var(--surface-hover);
}

/* === DASHBOARD === */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.dash-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.dash-stat::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--green);
    border-radius: 0 4px 4px 0;
}
.dash-stat .ds-label {
    font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); margin-bottom: 6px;
}
.dash-stat .ds-value {
    font-size: 1.5rem; font-weight: 700; color: var(--text);
}
.dash-stat .ds-value.sm {
    font-size: 0.88rem; margin-top: 4px;
}

.dash-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* === FORMS === */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 0.82rem; font-weight: 600;
    color: var(--text); margin-bottom: 5px;
}
.form-label .label-hint {
    font-weight: 400; color: var(--text-muted); margin-left: 4px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    background: var(--surface);
    transition: all var(--ease);
    outline: none;
}
.form-control:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(122,181,29,0.15);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235f6572' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-control-file {
    width: 100%;
    padding: 10px 14px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-sec);
    background: var(--surface-hover);
    cursor: pointer;
    transition: all var(--ease);
}
.form-control-file:hover,
.form-control-file:focus {
    border-color: var(--green);
    background: var(--green-lighter);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ease);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); box-shadow: 0 2px 8px rgba(122,181,29,0.35); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-sec);
}
.btn-outline:hover {
    background: var(--surface-hover);
    border-color: var(--text-muted);
    color: var(--text);
}

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: var(--green-hover); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: 6px; }
.btn-block { width: 100%; justify-content: center; }

/* === ALERTS === */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    animation: alertSlide 0.3s ease-out;
}
@keyframes alertSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-success { background: var(--success-light); color: #0a6b35; border: 1px solid #b6e8cd; }
.alert-danger { background: var(--danger-light); color: #9b2520; border: 1px solid #f5c6c3; }
.alert-warning { background: var(--warning-light); color: #8a6210; border: 1px solid #f5dfa0; }

/* === CONTACT LIST === */
.contact-list { list-style: none; }
.contact-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--ease);
}
.contact-item:last-child { border-bottom: none; }
.contact-item:hover { background: var(--surface-hover); }
.contact-info { display: flex; align-items: center; gap: 13px; }
.contact-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--green-light);
    color: var(--green-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.82rem; flex-shrink: 0;
}
.contact-name { font-weight: 600; font-size: 0.88rem; }
.contact-fax {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-sec);
    margin-top: 1px;
}

/* === HISTORY === */
.history-item {
    display: flex;
    align-items: flex-start;
    gap: 13px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-light);
}
.history-item:last-child { border-bottom: none; }
.history-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--green-light);
    color: var(--green);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px;
}
.history-details { flex: 1; min-width: 0; }
.history-recipient {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem; font-weight: 500;
}
.history-file {
    font-size: 0.8rem;
    color: var(--text-sec);
    margin-top: 2px;
}
.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    text-align: right;
    line-height: 1.5;
}

/* === PAGINATION === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 18px 0;
    list-style: none;
}
.pagination a, .pagination span {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    font-size: 0.83rem; font-weight: 500;
    color: var(--text-sec);
    text-decoration: none;
    transition: all var(--ease);
}
.pagination a:hover { background: var(--surface-hover); color: var(--text); }
.pagination .active span { background: var(--green); color: #fff; }

/* === PRICING === */
.price-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}
.price-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 22px;
    text-align: center;
    transition: all var(--ease);
}
.price-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.price-card .price-label {
    font-size: 0.75rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); margin-bottom: 10px;
}
.price-card .price-value {
    font-size: 1.9rem; font-weight: 700;
    color: var(--text); line-height: 1.2;
}
.price-card .price-value span {
    font-size: 0.82rem; font-weight: 400; color: var(--text-sec);
}
.price-card .price-detail {
    font-size: 0.8rem; color: var(--text-sec); margin-top: 7px;
}

/* === BADGES === */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 99px;
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-online { background: var(--green-light); color: var(--green-dark); }
.badge-info { background: var(--green-light); color: var(--green-dark); }
.badge-count { background: var(--surface-hover); color: var(--text-sec); border: 1px solid var(--border); }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}
.empty-state svg { width: 44px; height: 44px; margin-bottom: 14px; opacity: 0.35; }
.empty-state p { font-size: 0.88rem; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .hamburger { display: block; }
    .main-content { margin-left: 0; }
    .topbar { padding: 0 20px; }
    .page-content { padding: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr 1fr; }
    .dash-cols { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .price-cards { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .login-box { padding: 32px 24px; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-content > *:first-child { animation: fadeIn 0.3s ease-out; }
