<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>@yield('title', 'Dashboard') — {{ $__company->name ?? 'Nowills SQC ERP' }}</title>
<link rel="stylesheet" href="{{ asset('css/erp.css') }}">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><rect width='100' height='100' rx='18' fill='%23f26a1b'/><text x='50' y='68' font-size='55' text-anchor='middle' fill='white' font-family='Arial' font-weight='bold'>N</text></svg>">
</head>
<body>
<div class="scrim"></div>
<aside class="side">
  <div class="brand">
    <div class="logo">N</div>
    <div><b>{{ $__company->name ?? 'Nowills SQC ERP' }}</b><span>Quarry · Construction</span></div>
  </div>
  @include('partials.sidebar')
  <div class="side-foot">Nowills SQC ERP v1.0<br>Laravel + MySQL · {{ date('Y') }}</div>
</aside>
<div class="main">
  <div class="topbar"><div class="hazard-thin"></div>
    <div class="topbar-in">
      <button class="burger" type="button">☰</button>
      <div class="crumbs">@yield('crumbs', '<b>Dashboard</b>')</div>
      <div class="top-right">
        <button class="btn btn-sm btn-ghost" id="gSearchBtn" title="Search (Ctrl/⌘+K)">🔍 <span class="muted">Search</span></button>
        <span class="muted small" id="clock"></span>
        @if($__fy)<span class="fy-pill">{{ $__fy->name }}{{ $__fy->is_closed ? ' 🔒' : '' }}</span>@endif
        <a class="user-chip" href="{{ route('notifications.index') }}" title="Notifications">🔔@if(($notifCount ?? 0)>0)<span class="bdg b-err">{{ $notifCount }}</span>@endif</a>
        <a class="user-chip" href="{{ route('profile') }}" title="Profile"><span class="av">{{ strtoupper(substr(auth()->user()->name,0,1)) }}</span><span>{{ auth()->user()->name }}</span></a>
        <form method="POST" action="{{ route('logout') }}" style="margin:0"><button class="btn btn-sm btn-ghost" title="Sign out">⏻</button>@csrf</form>
      </div>
    </div>
  </div>
  <div class="content">
    @include('partials.flash')
    @yield('content')
  </div>
</div>
<div id="gSearchWrap" style="display:none;position:fixed;inset:0;z-index:200;background:rgba(0,0,0,.45);padding:10vh 16px 16px" onclick="if(event.target===this)GSearch.close()">
  <div style="max-width:620px;margin:0 auto;background:var(--card,#fff);border-radius:10px;box-shadow:0 18px 50px rgba(0,0,0,.35);overflow:hidden">
    <input id="gSearchInput" type="text" placeholder="Search customers, suppliers, equipment, invoices… (min 2 chars)" autocomplete="off"
      style="width:100%;box-sizing:border-box;padding:14px 16px;font-size:15px;border:0;border-bottom:1px solid var(--border);outline:none">
    <div id="gSearchRes" style="max-height:50vh;overflow:auto;padding:6px 0"></div>
  </div>
</div>
<script src="{{ asset('js/erp.js') }}"></script>
@stack('scripts')
</body>
</html>
